试图更改样式表网址

时间:2012-12-08 16:43:37

标签: .htaccess

这是我当前的.htaccess文件:

RewriteEngine On

RewriteBase /application/

RewriteRule (.*)/css/(.*).css www/$1/css/$2.css

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) index.php?p=$1

所以我的最终目标是

http://localhost/application/guestbook/css/style.css

转发到

/application/www/guestbook/css/style.css

它几乎正常工作,但当我倾销$ _GET时,我可以看到他正在寻找的网址是

www/www/guestbook/css/style.css

有人可以告诉我为什么它有2次www /?我该如何解决?

1 个答案:

答案 0 :(得分:2)

这是一种方法:

<强>已更新

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^.*/(\w+/\w+/\w+\.css)$
RewriteRule .* application/www/%1 [L]

将重定向此:

http://localhost/application/anything1/anything2/anything3.css

http://localhost/application/www/anything1/anything2/anything3.css