除图像文件外,我有以下规则来重写所有url路径和查询以 route 的形式访问index.php。但是,如果图像位于specific_folder内部,则也希望它们也通过index.php路由。
我的.htaccess现在看起来像这样:
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(gif|jpg|jpeg|png|webp)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
这使我可以重写除图像文件之外的所有内容以作为 route 进入index.php。但是,如果图像位于specific_folder内部,则也希望它们也通过index.php路由。
我在图像文件扩展名条件之后添加了以下行,但它似乎不起作用:
RewriteCond %{REQUEST_URI} /specific_folder/.*$