2014-12-31 24 views
2

工作我完成的代碼中我唯一.htaccess文件:的.htaccess不是在localhost

Options FollowSymLinks 
RewriteEngine On 
RewriteBase/

RewriteRule blue-world.pl/([a-z]+)(?:/([a-z]+))? index.php?nav=$1#$2 

我需要blue-world.pl/name/name2重定向到blue-world.pl?nav=name#name2。如何使它工作BOTH:本地主機和服務器。

爲毫安當我嘗試鍵入:localhost/scregal.blue-world.pl/title我看到:

The requested URL /scregal.blue-world.pl/title was not found on this server. 

下面是本地主機我的文件層次:

scregal.blue-world.pl 
    - .htaccess 
    - index.php -> var_dump($_GET) 

httpd.conf有下面幾行:

LoadModule rewrite_module modules/mod_rewrite.so 

AllowOverride All 

回答

2

您可以使用此規則:

Options FollowSymLinks 
RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]+)(?:/([^/]+))?/?$ index.php?nav=$1#$2 [L,QSA,NC] 
+0

仍然是一樣的錯誤 –

+0

那麼,我的什麼可能是錯的?我只是複製並粘貼你的代碼。 –

+0

我的錯誤,名稱中沒有'git'關鍵字。 –

相關問題