[英]help with mod_rewrite
我有這個.htaacces:
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
# Follow symbolic links in this directory.
Options +FollowSymLinks
RewriteEngine on
RewriteRule \.(css|jpe?g|gif|png)$ - [L]
RewriteRule ^([A-Za-z-]+)/?$ index.php?page=$1 [NC,L]
而且我的頁面上有一個鏈接:
<a href="store/">Store</a>
內容已加載,但css文件未正確加載,它的加載方式與在/ store /目錄中相同。 我知道我可以使用絕對鏈接,但我不想這么做。 因此,不久:
www.example.com/store一切正常
www.example.com/store/ php查找到/ store /文件夾,這是錯誤的
如何使其以兩種方式工作? 請幫忙。
唯一正確的方法是使用絕對鏈接-否則緩存將無法正常工作,並且您的頁面將加載緩慢。
另一種方法是捕獲對文件“ somefile.css”的任何請求,並將其重寫為您的css-但這會導致緩存問題
RewriteRule ^.*/(somefile.css)$ cssfloder/$1 [NC,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.