2012-08-07 88 views
0

我在.htaccess文件以下規則:URL重寫不重定向到正確的頁面

RewriteRule ^cat-([0-9]+)\.html$ ad_list_cat.php?category_no=$1 

的ad_list_cat.php文件是一個子文件/內容/。我也試過

RewriteRule ^cat-([0-9]+)\.html$ /contents/ad_list_cat.php?category_no=$1 

當我輸入網址的「http://localhost/cat-1.html」提示錯誤404 我覺得跟子文件夾中的問題。 我的規則怎麼了?

問候:

回答

0

因爲它正在尋找在你的根目錄的ad_list_cat.php。 請在開始提問時閱讀一些有關重新編寫規則的內容。

+0

親愛的Germann Arlington,我嘗試了'ad_list_cat.php?category_no = $ 1'和'/contents/ad_list_cat.php?category_no=$1',但都無效。 – 2012-08-08 04:00:00

+0

RewriteRule ^(。*)\。html $ $ 1.php [nc]這一行覆蓋了所有其餘的行。 – 2012-09-30 04:56:26