我有 url public/l/img/logo.png
,我想在我的公共(public)目录中使用 htaccess 查看 public/img/logo.png
。
我试过用这个但是没用
RewriteRule ^l/(.*)$ $1 [R=301,L]
我现在的htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
我的公共(public)目录是真实目录 提前致谢
最佳答案
情况 1:如果 public
是一个真实的目录,那么在 /public/.htaccess
中使用这个规则:
RewriteEngine On
RewriteBase /user/public/
RewriteRule ^l/(.+)$ $1 [NC,L]
情况 2: 如果 public
不是真实目录,则在根 .htaccess
中使用此规则:
RewriteEngine On
RewriteBase /
RewriteRule ^user/public/l/(.+)$ public/$1 [NC,L]
关于javascript - 为不同的 Url 重写 htaccess 规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31675445/