2012-02-23 120 views

回答

0

这在documentroot

RewriteEngine on 
RewriteBase/

RewriteCond %{REQUEST_URI} ^/invite 
RewriteRule ^invite/([^/]+)/(\w{2})$ auth/accept_invite/$1/$2 

从评论添加到您的.htaccess: 这些规则:

RewriteCond $1 !^(index\.php|robots\.txt|images|img|css|js|fonts) 
RewriteRule ^(.*)$ /index.php/$1 [L] 

将添加的index.php到每一个不index.php|robots\.txt|images|img|css|js|fonts开始规则因此你的/invite也会被重新编写tten到/index.php/invite...


试试这个以相同的顺序

RewriteEngine on 
RewriteBase/

RewriteCond %{ENV:REDIRECT_STATUS} 200 
RewriteRule^- [L] 

RewriteCond %{REQUEST_URI} ^/invite 
RewriteRule ^invite/([^/]+)/(\w{2})$ auth/accept_invite/$1/$2 [L] 

RewriteCond $1 !^(auth/|index\.php|robots\.txt|images|img|css|js|fonts) 
RewriteRule ^(.*)$ /index.php/$1 [L] 
+0

这不起作用。我也使用了下面的选项。再建议? – SNAG 2012-02-23 10:01:32

+0

1> 的RewriteCond%{REQUEST_URI}^/邀请 重写规则^ /邀请/([\ W \ - ] *)/([\ W \ - ] *)$ /index.php/auth/accept_invitation/$1/$ 2 1.1>(因为我已经使用这个废除的index.php) 的RewriteCond%{REQUEST_URI}^/邀请 重写规则^ /邀请/([\ 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 – SNAG 2012-02-23 10:01:53

+0

@SNAG您是否在共享主机上?并且启用了mod_rewrite? – ThinkingMonkey 2012-02-23 10:39:03

1

的RewriteCond%{HTTP_HOST}^mysite.com/invite/YhMck/en RewriteRule(。*)http://www.mysite.com/auth/accept_invite/YhMck/en/ $ 1 [R = 301,L] RewriteEngine叙述在

+0

的 “YhMck/EN” 部分会有所不同的参数,会有所不同。所以我可以使用*给他们吗? – SNAG 2012-02-23 07:33:06