【发布时间】:2023-03-26 15:25:02
【问题描述】:
我已经安装了带有 SEO Urls 的 Opencart,我已经更改了一些页面的结构,并希望对更改的页面进行 301 重定向,因此不会中断(外部)链接。但是我在 opencart 中激活了 SEO 链接,这意味着激活了一些重写规则,我猜这些会干扰我的 301 重定向代码。
最后一行是我的重定向。不是将http://keroproducts.ch/kaufen 重定向到http://keroproducts.ch/produkte/,而是重定向到:http://keroproducts.ch/produkte/?_route_=kaufen,这是不正确的。
这是我的 .htaccess 文件:
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/
RewriteCond %{HTTP_HOST} ^www\.keroproducts\.ch [NC]
RewriteRule ^(.*)$ http://keroproducts.ch/$1 [L,R=301]
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /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]
Redirect 301 /kaufen http://keroproducts.ch/
【问题讨论】:
-
您正在尝试在打开 RewriteEngine 之前重写。
-
我已经解决了这个问题。但问题依然存在,请查看更新的代码。
标签: apache .htaccess opencart http-status-code-301