使用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配置文件中进行此操作。
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.com
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
我这样使用:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.net
RewriteRule ^(.*)$ http://www.mysite.net/$1 [R=permanent,L]
重定向301 /pagename.php http://www.testdomain.com/pagename.html
注意:仅添加页面名称中的旧路径,以及添加域名中的新路径