2012-02-23 69 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