2011-01-30 23 views
3
Options +FollowSymlinks 

RewriteEngine on 

RewriteCond %{REQUEST_FILENAME} !-f # not a file 
RewriteCond %{REQUEST_FILENAME} !-d # not a directory 
RewriteRule ^(.+)$ index.php?params=$1 [L] 

,你可以看到,我想要的東西轉換像RewriteEngine不是本地重寫URL?

mysite.com/x/y/z

mysite.com/ index.php?params = x/y/z

但是,它不工作。我試過mysite.com/home,並在index.php的第一行放置了一個斷點,但得到了一個404.

任何想法爲什麼這不適合我?感謝任何事情!

回答

1

看來,要麼mod_rewrite未安裝或支持,或已設置了AllowOverride -directive的特定目錄None。更改爲(至少)FileInfo

+0

,它去了失敗者!非常感謝! – Garrett 2011-02-02 02:56:18

5

首先,確保mod_rewrite已在您的Apache服務器上啓用。

然後,在線條的末尾刪除評論:

# not a file 
RewriteCond %{REQUEST_FILENAME} !-f 
# not a directory 
RewriteCond %{REQUEST_FILENAME} !-d 

From the Apache documentation

線與哈希 「#」 字符開始被認爲是註釋, 和被忽略。 配置指令 之後的註釋可能不是 。

+0

令人驚訝的仍然不起作用=( – Garrett 2011-02-02 02:52:12