opencart .htaccess 301重定向
-
22-09-2019 - |
题
使用 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]
不隶属于 StackOverflow