views:

296

answers:

1

Hi I have an application which uses opencart. I would like to make a 301 reditect in case the user types http://mysite.com. To be redirected in http://www.mysite.com (301 status code)

Here is my .htaccess content:

#Options +FollowSymlinks

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]

It is doing 302 redirect.

Thanx, Granit

+1  A: 

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]
meme
Unfortunately it does not work for me!
Granit