0
我似乎無法得到我的頭。我只是從我的服務器上拉下我的網站文件以離線工作。但是,我的重寫條件不再按預期工作。本地主機上沒有發生Apache mod_rewrite
我已經googleing在過去的3小時,保持未來這些解決方案:在.htaccess文件
放垃圾,以確保它被讀取。我這樣做,並得到了500錯誤,所以它。
確保mod_rewrite已啓用,並確保它已在php_info()中列出。這不是問題。
除此之外,我無法弄清楚這件事。
這是我的.htaccess。所有我想要做的就是從我的網址中刪除的index.php:
# Rewrite url no index.php
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule . index.php
這裏的那一刻我的虛擬主機配置:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "c:/wamp/www/myapp/public_html/"
<Directory "c:/wamp/www/myapp/public_html/">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ServerName myapp.local
ErrorLog "logs/myapp.local"
CustomLog "logs/myapp.local" common
</VirtualHost>
我還想讓它知道重寫規則似乎有點當他們在虛擬主機配置。因此,像這樣:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "c:/wamp/www/myapp/public_html/"
<Directory "c:/wamp/www/myapp/public_html/">
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# ...other settings...
</Directory>
ServerName myapp.local
ErrorLog "logs/myapp.local"
CustomLog "logs/myapp.local" common
</VirtualHost>
我有其他問題,這雖然因爲我有嵌套應用程序(一個是在/和其他AT/APP 2 /)。我似乎也遇到了忽略!-f條件的問題,它會重寫我的圖像和CSS的URL。
有沒有人有任何想法如何解決這個問題?提前致謝!
我只是嘗試將您的代碼添加到我的htaccess文件,而不是我的,但我得到相同的結果。任何其他想法? – Fittersman