更新 htaccess rewriterule、js、css 和图像后 Opencart 不加载

问题描述 投票:0回答:1

通常我们会有类似这样的 opencart 网址

http://localhost/sample/

我正在尝试向这个网址添加位置,就像这样

http://localhost/sample/geolocation

所以我修改了我的 htaccess 以相应地工作并且它有效但它确实破坏了我的 JS,CSS 和图像。

Options +FollowSymlinks
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|\.twig|\.ini|\.log|(?<!robots)\.txt))">
 Require all denied
</FilesMatch>

RewriteEngine On

RewriteBase /sample/

RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)

RewriteRule ^([^?]*)/([^?]*) index.php?city=$1&_route_=$2 [L,QSA]  # This is my modification
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

这是我的一个 js url 看起来像

http://localhost/sample/catalog/view/javascript/jquery/jquery-2.1.1.min.js

php .htaccess opencart opencart-3
1个回答
0
投票

我在每个目录中创建了一个

.htaccess
文件我想跳过重写并将其放入文件

RewriteEngine Off
© www.soinside.com 2019 - 2024. All rights reserved.