Redirect 301 to www...

Hello



A little bit stuck with simple seo rule. I need redirect 301 mydomain.com to www.mydomain.com



I added 2 lines in the default htaccess, now it is as follows:


```php

DirectoryIndex index.html index.php



RewriteEngine on

Some hostings require RewriteBase to be uncommented

Example:

Your store url is http://www.yourcompany.com/store/cart

So “RewriteBase” should be:

RewriteBase /store/cart

#RewriteBase /

RewriteCond %{HTTP_HOST} ^mydomain.com$ [NC]

RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !.(png|gif|ico|swf|jpe?g|js|css)$

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . index.php?sef_rewrite=1 [L,QSA]



```



Like this it give error and does not show the page.



Where is a mistake?



Thanks in advance for any help.

You don't need to change your .htaccess file. In your config.local.php you have something like:


// Host and directory where software is installed on no-secure server
$config['http_host'] = 'domain.com';
$config['http_path'] = '';

// Host and directory where software is installed on secure server
$config['https_host'] = 'domain.com';
$config['https_path'] = '';




Just change that to:


// Host and directory where software is installed on no-secure server
$config['http_host'] = 'www.domain.com';
$config['http_path'] = '';

// Host and directory where software is installed on secure server
$config['https_host'] = 'www.domain.com';
$config['https_path'] = '';




Also, this has been asked a bunch of times on here. If you used the search, I'm sure you'll see this exact same answer somewhere.



Thanks,



Brandon

Thanks Brandon,



I probably missed it because I was searching for htaccess redirect.





thanks again for prompt answer

So how do we do this in CS-Cart Ultimate? My main store is www.domain.com - domain.com redirects to www.domain.com, however, all other stores are domain2.com, domain3.com, etc. I would much prefer www.domain2.com and www.domain3.com, but only the primary domain is referenced in config.local.php.

Good question!!!



I would like to know it also, as I fighting to test varios shops (Ultimate edition) on XAMPP or Denwer or PLESK.



For the moment there is instructions for CPanel. But still not very clear for other systems…



Thanks.