2011-02-10 53 views
0

我的虛擬主機:的mod_rewrite 404的

Options +Indexes +FollowSymlinks 
AllowOverride All 
Order allow,deny 
Allow from all 

的.htaccess:

<IfModule mod_rewrite.c> 
Options +FollowSymLinks 
RewriteBase/
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^/]*)/([^/]*)$ /?id=$1&v=$2 [L] 
</IfModule> 

我的網址看起來像這樣

http://hatchpass.local/?id=fbb43&v=minimal 

mod_rewrite的Apache中啓用了,我已經證實它加載,但是,當我嘗試類似http://hatchpass.local/fbb43我得到404'd。

想法?

回答

0

您的RewriteRule的正則表達式匹配foo/bar。 URL(「http://hatchpass.local/fbb43」)不適用於此。它只是傳入爲「fbb43」。

+0

啊!當然。 v是一個可選參數,所以我從來沒有用它進行測試,但是我將它包含在條件中。規則應該是:RewriteRule ^([^ /] *)$ /?id = $ 1 [L] – 2011-02-12 04:11:37