在OpenCart管理面板中启用SEO URL后,所有链接都返回404 - 未找到。
我的 .htaccess 文件
# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/
RewriteBase /
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?_route_=$1 [L,QSA]
该网站位于/var/www/html/opencurt
,我正在尝试更改为RewriteBase /opencurt
,但它对我没有帮助。我还清除了缓存。
我的本地计算机上的当前 URL 已http://127.0.0.1/
我知道这是常见问题,但我自己无法解决。
所有 firs of all - 采用默认的 .htaccess.txt文件从您的版本中 OpenCart pakage.
现在,您必须将.htaccess.txt重命名为.htaccess。在Windows上并不容易。用记事本打开它,然后另存为文件,将其重命名为 .htaccess而不.txt
.
虽然,请确保您使用的是Apache网络服务器,因为只有
如果您使用这样的地址 http://127.0.0.1/- 您的重写基础是RewriteBase /
.
在SEOURL中,您应该仅使用拉丁符号,数字,减号(-(和下划线(_(。没有空格或其他特殊字符。
更新
每个类别,产品,制造商都有SEO字段。您应该将每个字段的SEO字段填写到SEO URL(或更好的SEO PRO(工作正确。
已更新 2
如果 apache 没有看到 .htaccess 文件 - 你应该去 apache .conf 文件并在 VirtualHost 块之后添加
<Directory /var/www/html/your_folder/>
Options Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
目录 - 是虚拟服务器根目录的路径。重新启动 apache。应该工作。