.htaccess 文件阻止图像加载

时间:2021-07-18 08:53:57

标签: .htaccess mod-rewrite

我有一个 .htaccess 文件,我用它来重写我的网址。

RewriteEngine On

RewriteRule ^configurator/(.+)$ configurator.php?pc=$1 [QSA,L]

RewriteRule ^product/(.+)$ product.php?product=$1 [QSA,L]

RewriteRule ^(.+)$ index.php?page=$1 [QSA,L]

在我的配置器中,我的图像没有加载。如果我禁用 .htaccess 文件并且我去他们加载的我的图像的路径。 如何让我的 .htaccess 文件不阻止图像加载?

1 个答案:

答案 0 :(得分:0)

根据您显示的尝试,请尝试以下操作。确保在测试 URL 之前清除浏览器缓存。还要确保您的 htaccess 规则文件位于文件夹(配置器、产品)所在的同一文件夹中。

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^configurator/(.+)/?$ configurator.php?pc=$1 [NC,QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^product/(.+)/?$ product.php?product=$1 [NC,QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/?$ index.php?page=$1 [NC,QSA,L]