2012-02-23 89 views
0

您好我想重定向的URL:笨的.htaccess国防部重写不工作

http://localhost/invite/yK-as8_/Subhrojit_Nag

http://localhost/auth/accept_invitation/yK-as8_/Subhrojit_Nag

我用下面的重写,但他们都不工作。 htaccess文件位于文档根路径中。请帮忙。 “

1>

RewriteCond %{REQUEST_URI} ^/invite 

RewriteRule ^/invite/([\w\-]*)/([\w\-]*)$ /index.php/auth/accept_invitation/$1/$2 

1.1>(因为我已经使用此废除的index.php)

RewriteCond %{REQUEST_URI} ^/invite 

RewriteRule ^/invite/([\w\-]*)/([\w\-]*)$ /auth/accept_invitation/$1/$2 

2>

RewriteCond %{REQUEST_URI} ^([\w\-.\/:]*)\/invite\/([\w\-]*)\/([\w\-]*)$ 

RewriteRule ^([\w\-.\/:]*)\/invite\/([\w\-]*)\/([\w\-]*)$ $1/index.php/auth/accept_invitation/$2/$3 

回答

1

试试这个CONFIGS的.htaccess文件。 记得把它放在系统文件夹和index.php文件所在的根目录下。

RewriteEngine On 
RewriteCond %{REQUEST_URI} ^/system.* 
RewriteRule ^(.*)$ index.php?/$1 [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.+)$ index.php?/$1 [L] 

我希望它有帮助。

问候,
Elkas

0

尝试点东西柯本

RewriteRule ^invite/(.*)$ auth/accept_invitation/$1 [R] 

我不知道是否有某种在你的URL模式的,所以我用贪婪的比赛,只是捕捉一切。

RegExr:http://regexr.com?303qt

+0

你能告诉我是什么[R]代表什么吗? – SNAG 2012-02-23 10:23:46

+0

@SNAG它意味着重定向用户。 http://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_r – 2012-02-24 03:32:21