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