opencart 2.3.0.2 htaccess 301重定向

opencart 2.3.0.2 htaccess 301 redirect

我尝试了我在网上找到的其他解决方案,但没有锻炼。 我的 htaccess 文件如下所示:

Options +FollowSymlinks
Options -Indexes
<FilesMatch "(?i)((\.tpl|\.ini|\.log))">
 Order deny,allow
 Deny from all
 </FilesMatch>

RewriteEngine On
Redirect 301 ^abc https://www.example.com/abc-products


RewriteCond %{THE_REQUEST} \.html
RewriteRule ^(.*)\.html$ / [R=301,L]

RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/ [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteBase /
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/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_= [L,QSA]

我期待 example.com/abc url 重定向到 example.com/abc-products 但它正在重定向到 example.com/abc-products?_route_=abc

我也试过下面的方法

Redirect 301 ^abc https://www.example.com/abc-products
Redirect 301 ^/abc /abc-products
Redirect 301 /abc /abc-products

但结果总是https://www.example.com/abc-products?_route_=abc

之后再试

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

添加

 RewriteRule ^abc/(.*)$ /abc-products/ [R=301,NC,L]

我认为你应该试试这个代码。 100% 工作。

Options +FollowSymlinks
Options -Indexes
<FilesMatch "(?i)((\.tpl|\.ini|\.log))">
 Order deny,allow
 Deny from all
 </FilesMatch>

RewriteCond %{THE_REQUEST} \.html
RewriteRule ^(.*)\.html$ / [R=301,L]

RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/ [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteBase /
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/download/(.*) index.php?route=error/not_found [L]
Redirect 301 / https://www.example.com/abc-products
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_= [L,QSA]

如果你没有工作好。告诉我一声。 谢谢