【发布时间】:2013-01-05 06:47:20
【问题描述】:
好吧,我已经在 stackoverflow 上阅读了页面和更多页面的 htaccess 指南和问题,但是仍然我还没有找到这个问题的答案。
我希望将 URL www.domain.com/profile/1 重定向到 www.domain.com/profile.php?id=1,并将 sabe 重定向到 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 位于文件夹 css/ 中,如果我通过 profile.php?id=1 直接访问它会正确加载(www.domain.com/css/style.css),但是当我访问掩码,它试图在 www.domain.com/profile/1/css/style.css 找到 css,但没有找到。
我一直用这个作为临时修复
RewriteRule ^(.*)/(css|js)/(.*).(css|js)$ css/$3.$4 [L]
RewriteRule ^(.*)/img/(.*).(jpg|png)$ img/$2.$3 [L]
但它看起来并不整洁和漂亮:(
我怎样才能让它正确地加载 CSS?
【问题讨论】:
标签: .htaccess mod-rewrite redirect get