OpenCart .htaccess 301重定向

问题描述 投票:1回答:3

使用OpenCart我将如何使用301重定向将www.添加到域中

.htaccess内容:

#Options +FollowSymlinks

<IfModule mod_rewrite.c>
RewriteEngine On

#OPENCART REWRITES START
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php
#OPENCART REWRITES END

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC]
RewriteRule ^(.*)$ http://www\.mysite\.com/$1 [R=301,L]
</IfModule>

请注意,302重定向正在工作

apache .htaccess http-status-code-301 opencart
3个回答
2
投票

我认为您要做的就是在Apache配置文件中进行此操作。

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L] 

0
投票

我这样使用:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.net
RewriteRule ^(.*)$ http://www.mysite.net/$1 [R=permanent,L]

0
投票

重定向301 /pagename.php http://www.testdomain.com/pagename.html

注意:仅添加页面名称中的旧路径,以及添加域名中的新路径

© www.soinside.com 2019 - 2024. All rights reserved.