Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How do I redirect to www? 
 
elong
Jr. Member
 
Total Posts:  17
Joined:  2008-02-15
 

As with most ecommerce engines, URLs are normally writting as http://example.com. My hosting company, hostmonster, requires me to get a cert with the address of http://www.example.com. Now, when I go to the login page, or to checkout, I get the warning from the browser about the potential since the url is https://example.com and it expects https://www.example.com. Some customers may be deterred by this message.

So, my question, and maybe there is a better way of doing this that what I am asking, is how do I get magento to automatically redirect with the “www”? Do I use an apache rewrite? I’ve tried that but have been unsuccessful. Or is there another solution that would be better?

Thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
zadpro
Sr. Member
 
Avatar
Total Posts:  247
Joined:  2007-12-10
FL, USA
 

Visit this page, hopefully it will help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
elong
Jr. Member
 
Total Posts:  17
Joined:  2008-02-15
 

Thank you. That worked for what I requested. However, I should have realized that did not solve my problem. The links to the secure part of the site follow the patter https://example.com. Unfortunately, my host requires my the cert be assigned to http://www.example.com. The apache rewrites will reformat the url correctly, but I still get the warning from the browser because the verification of the cert happens before the rewrite.

So, I guess my real question is if there is a configuration file or environment variable I can set so that the www is not stripped out of the site for my links. If not, it appears I will have to go through the code, and this seems like a fairly daunting and inflexible solution, especially since new versions seem to come out quickly.

 
Magento Community Magento Community
Magento Community
Magento Community
 
zadpro
Sr. Member
 
Avatar
Total Posts:  247
Joined:  2007-12-10
FL, USA
 

Go to admin --> System --> Configuration --> Web.
There are two text boxes for “Base URL” one in unsecure and one in secure section. Yours should look like http://example.com/. Just add www to that and it should do what you are looking for. => base UR: should look like: http://www.example.com/ (don’t forget the / at the end).

Good luck

 
Magento Community Magento Community
Magento Community
Magento Community
 
elong
Jr. Member
 
Total Posts:  17
Joined:  2008-02-15
 

Excellent. Thank you.

It appears that the http addresses are now prepended with www. However, the https addresses still do not have the www even though I changed it in the config screen as mentioned above.

Is this a bug, or is there another config tweak needed?

Thank you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
zadpro
Sr. Member
 
Avatar
Total Posts:  247
Joined:  2007-12-10
FL, USA
 

have you cleared your store cache?

 
Magento Community Magento Community
Magento Community
Magento Community
 
elong
Jr. Member
 
Total Posts:  17
Joined:  2008-02-15
 

Wow, I am not used to working with software that is this configurable and usable from a non-code required perspective. I cleared the cache and it worked like a charm. Thank you once again.

 
Magento Community Magento Community
Magento Community
Magento Community
 
zadpro
Sr. Member
 
Avatar
Total Posts:  247
Joined:  2007-12-10
FL, USA
 

You are welcome ... And good luck

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top