I have a magento site deployed at for example www.example.com and a test site deployed at test.example.com. To resolve cookie conflict between the domain and the sub domain, I was forced to make the Session Cookie management configuration like this: enter image description here

Now I am only able to login to admin via www.example.com/admin If I write example.com and try to login, I can not login. So, I want to add 'www' to the admin url automatically if the user does not add that to the url.

How that can be achieve. Any help in this regard will be much appreciated.


You can achieve this from the .htaccess by redirecting all users to use www e.g

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

From https://stackoverflow.com/questions/27138510/redirect-non-www-to-www-on-magento

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.