1
我有一個mod-rewrite的問題。mod_rewrite多個RewriteCond衝突
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent]
# For all files not found in the file system, reroute the request to the
# "index.php" front controller, keeping the query string intact
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule^index.php [L]
</IfModule>
# IE Cache fix?
ExpiresActive On
ExpiresDefault A1
Header append Cache-Control must-revalidate
重定向不起作用,沒有樣式或圖像顯示。
如果這些三行註釋掉,它的工作原理:
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule^index.php [L]
但我需要的任何錯誤entery重定向到根。這是如何協同工作的?或者爲什麼它沒有像這樣工作?
那麼你的HTTP服務器的日誌文件說出請求被寫入的內容,以便它們失敗? – arkascha 2014-12-07 14:44:24
我剛添加了部件: RewriteCond%{HTTP_HOST}^example \ .com $ [NC] RewriteRule ^(。*)$ http://www.example.com/$1 [R = permanent] First我只有重定向規則缺少文件/直播的規則。這也工作得很好。但是這兩個RewriteRules一起不適合我。 – blubbering 2014-12-07 14:56:19
您可以嘗試在頁面的HTML標頭中添加以下內容: ',以便每個相對URL都從該URL中解析出來,而不是當前頁面的URL。 –
anubhava
2014-12-07 17:47:48