문제

Using OpenCart how would I use a 301 redirect to add www. to the domain

.htaccess content:

#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>

Note that 302 redirects are working

도움이 되었습니까?

해결책

I think all that you are wanting to do is this inside of your Apache config file.

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

다른 팁

I use like this:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite\.net
RewriteRule ^(.*)$ http://www.mysite.net/$1 [R=permanent,L]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top