0
我使用的XAMPP(Windows 7)中,並在httpd.conf我:XAMPP - 重寫規則不起作用
- 的AllowOverride所有
- 的LoadModule rewrite_module模塊/ mod_rewrite.so(取消註釋)
在htdocs目錄我有一個子目錄叫做店我的網站在哪裏。裏面店我多了一個子目錄叫襯衫包含文件:
- shirts.php
要打開它,你只是NEET輸入以下網址:http://localhost/shop/shirts/shirts.php
但,當我打開時只需http://localhost/shop/shirts/ - 瀏覽器顯示一個目錄列表,我希望它打開shirts.php。
因此,內/襯衫目錄我創建了以下的.htaccess文件:
RewriteEngine On
RewriteRule ^shirts/$ /shop/shirts/shirts.php
但它不工作。你知道我在做什麼錯,爲什麼這不起作用?
在此先感謝!
請指定正好在.htaccess把此行。這可能很重要。 – Alex
這工作,謝謝。我看了一些視頻課程,不明白爲什麼作者使用'RewriteEngine On RewriteEngine On RewriteRule^shirts/$/shop/shirts/shirts.php',這對他的XAMPP(本地主機)的安裝起作用,但它不適用於我?無論如何,你的答案解決了我的問題。 – PeraMika