Opencart SEO重写404错误

Opencart SEO rewrite 404 error

我在为经营网上商店的人工作。现在网上商店运行在 Opencart 软件上,幸运的是他们支持 SEO Url 重写。在过去的 2 个小时里,我一直在努力让它工作,但一直没能成功。我对 .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_= [L,QSA]

此外,我在 opencart 上启用了 SEO 重写,并为所有 products/categories 等赋予了 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.

有人能给我解决方案吗?

举个例子,我想要以下 link:http://aquadeco.eu/index.php?route=product/category&path=94_291 to look like this: http://aquadeco.eu/aquaria/adm-aquaria

你不必把这个 RewriteBase /opencart/

如果您的 url 是这样的 yourDomain.com/opencart/index... 那么 你将不得不把 RewriteBase /opencart/ 万一; :)

用你的 url 你不必把 RewriteBase /opencart/ 只有 /

此致

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

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

RewriteBase /opencart/ 改为 RewriteBase /

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