我想通过local.myproject / assets / logo.jpg访问此文件夹中的图像文件 请注意,/ img /文件夹不在URL
中。|-webroot
|-js
|-img
|-assets
|-logo.jpg
如何在htaccess上配置它 目前我在webroot下的.httacess就像
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteRule ^assets/(.*)$ img/assets/$1 [R=301,L]
</IfModule>
这不起作用。
答案 0 :(得分:0)
尝试以下规则:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^assets(.*)$ /img/assets$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>