【发布时间】:2020-05-20 06:23:32
【问题描述】:
我被困在.htaccess。
链接:
www.example.com/assets/images/abc.png
只要abc.png 存在于这个/assets/images 目录中,然后在浏览器中预览图像。但是如果我从这个目录中删除abc.png图像,它将重定向404找不到页面但我想重定向到主页(root url:www.example.com)
我想要这样:每当特定 /assets/images 文件夹的图像文件不存在时。它应该重定向到主页。
我试过了,但没用
RewriteEngine On
RewriteBase /
#If the file does not exist assets/images folder it will redirect on homepage
RewriteCond %{REQUEST_URI} !^/assets/images/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
【问题讨论】:
标签: laravel .htaccess url-rewriting