静态内容的htaccess无法正常工作!
|
因此,我设置了以下几行,以将一些请求重定向到我的静态域:
RewriteEngine On
RewriteBase /
RewriteRule ^img/(.*)$ http://static.mydomain.com/img/$1 [R=301]
RewriteRule ^css/(.*)$ http://static.mydomain.com/css/$1 [R=301]
RewriteRule ^js/(.*)$ http://static.mydomain.com/js/$1 [R=301,L]
但是由于某种原因,当我链接到一张图片时:
<img src=\"img/icons/hello.png\">
当静态服务器上确实存在它时,它会显示404(这实际上意味着它没有被重定向)。
我究竟做错了什么?我花了两个小时来尝试我所知道的一切,但没有找到解决方法。
提前非常感谢您。这是我完整的htaccess文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^img/(.*)$ http://static.mydomain.com/img/$1 [R=301]
RewriteRule ^css/(.*)$ http://static.mydomain.com/css/$1 [R=301]
RewriteRule ^js/(.*)$ http://static.mydomain.com/js/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
没有找到相关结果
已邀请:
1 个回复
娠频摩