Opencart SEO重写404错误


Opencart SEO rewrite 404 error

我为一个经营网店的人工作。现在这个网店运行在Opencart软件上,幸运的是他们支持SEO Url重写。在过去的两个小时里,我一直在努力让它发挥作用,但一直没能把它做好。我已经对.htaccess文件执行了以下操作。

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 
# 2. In your opencart directory rename htaccess.txt to .htaccess.
# For any support issues please visit: http://www.opencart.com
Options +FollowSymlinks
# Prevent Directoy listing 
Options -Indexes
# Prevent Direct Access to files
<FilesMatch ".(tpl|ini|log)">
 Order deny,allow
 Deny from all
</FilesMatch>
# 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 /opencart/
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [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]

此外,我在opencart上启用了SEO重写,并为所有产品/类别等提供了SEO名称。

现在.htaccess文件位于:public_html/opencart/,所以我已经将RewriteBase从/更改为/opencart/

我仍然得到以下错误:

Not Found
The requested URL /aquaria/adm-aquaria was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

有人能帮我解决问题吗?

举个例子,我想要以下链接:http://aquadeco.eu/index.php?route=product/category&path=94_291,如下所示:http://aquadeco.eu/aquaria/adm-aquaria

您不必将重写Base/opencart/

如果你的url是这样的yourDomain.com/opencart/index……那么您必须将"重写基础"/opencart/结束if;:)

有了你的url,你就不必放RewriteBase/opencart/仅/

问候

好吧,哇,我刚刚发现我一直都很愚蠢。我有2.htaccess文件。一个是没有正确重写规则的原件,另一个在我的/opencart/文件夹中,有正确重写规则。我现在所做的是将正确的重写规则放入根文件夹中的.htaccess文件,它解决了问题!!:D

您将站点放在子目录中,因此您必须进行以下更改

RewriteBase/opencart/更改为RewriteBase/

重写规则^([^?]*)index.php路由=$1[L,QSA]更改为重写规则^([^?]*)/opencart/index.php路由=$1[L,QSA]