那麼,我已經閱讀頁面和更多頁面的htaccess指南和問題在這裏在stackoverflow,但仍然我還沒有找到這個問題的答案。htaccess重定向GET變量沒有觸及css鏈接
我希望將網址www.domain.com/profile/1重定向到www.domain.com/profile.php?id=1,並將網址改爲www.domain.com/profile/ranisalt重定向到www.domain.com/profile.php?seo=ranisalt
我使用這個重寫規則,它已經在重定向一直不錯:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^profile/([0-9]+)/ profile.php?id=$1 [NC,QSA,L]
(there is more, but not relevant)
的問題是,在CSS如果我直接訪問profile.php?id = 1,它會正確加載(www.domain.com/css/style.css),但當我訪問該掩碼時,它會嘗試在www處查找css .domain.c om/profile/1/css/style.css,找不到。
我一直在使用這個作爲一個臨時的解決辦法
RewriteRule ^(.*)/(css|js)/(.*).(css|js)$ css/$3.$4 [L]
RewriteRule ^(.*)/img/(.*).(jpg|png)$ img/$2.$3 [L]
但它看起來並不整齊,美觀大方:(
我怎樣才能使加載CSS精美,正確?
它沒有任何改變,它仍然試圖找到/型材/ CSS /(...) – ranisalt