dongxiatuo9827 2013-05-23 22:58
浏览 36

Codeigniter:将预定义的URL重定向到默认控制器的方法

There are two predefined URLs which I want to redirect to default controller's method and return default responses. URLs are:

URL 1: http://EnrollmentService.mydomain.com/EnrollmentServer/Discover.svc (GET request)

URL 2: https://EnrollmentService.mydomain.com/EnrollmentServer/Discover.svc (POST request)

I tried adding following to .htaccess file but no luck.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /testsaav/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    Redirect /enrollmentserver/Discover.svc http://localhost/projectname/
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Right now I am trying to redirect http://localhost/projectname/EnrollmentServer/Discover.svc to default controller's index method.
I have created a project with default controller name enrollmentserver.php but when I tried to access http://localhost/projectname/enrollmentserver, I got Object not found error

How would redirect both the urls to default controller's any method?

  • 写回答

1条回答 默认 最新

  • dtq7387 2013-05-23 23:15
    关注

    You should use the default CI routes system. In your application/config/routes file:

    $route['EnrollmentServer/Discover.svc'] = "projectname";
    

    Or generically:

    $route['EnrollmentServer/:any'] = "projectname";
    

    Assuming "projectname" is the controller you want to route to

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料