how to add prefix www to URL permanently [solved]

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
coolji
New Member
New Member
Posts: 8
Joined: Wed Jan 14, 2009 1:58 am

how to add prefix www to URL permanently [solved]

Post by coolji »

Hi all,

I just installed the module GoogleSitemap on my client site. zenclimb.com. I tried to submit sitemap link http://zenclimb.com/sitemap.xml to Google, but Google would not accept URL without the prefix www. So I added prefix www in config.php. It works if just type zenclimb.com, it will redirect to http://www.zenclimb.com. However, if I add the sub pages, http://zenclimb.com/programs.html, it will not add prefix www. The problem is Google still not recognize my sitemap URL.

Do you know if there is any ways to add prefix www permanently?

Thanks in advance!

Jason
Last edited by coolji on Mon Aug 29, 2011 4:03 am, edited 1 time in total.
coolji
New Member
New Member
Posts: 8
Joined: Wed Jan 14, 2009 1:58 am

Re: how to add prefix www to URL permanently

Post by coolji »

I found a solution to add prefix www.

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

Howerver, Google still not reconize this change. Here is the error message from Google.
Paths don't match
We've detected that you submitted your Sitemap using a URL path that includes the www prefix (for instance, http://www.example.com/sitemap.xml). However, the URLs listed inside your Sitemap don't use the www prefix (for instance, http://example.com/myfile.htm).
Do you have any solutions?

Thanks,

Jason
uniqu3

Re: how to add prefix www to URL permanently

Post by uniqu3 »

How does your config.php $config['root_url'] look like?
I bet there is www. missing that is why your sitemap is created without www.
coolji
New Member
New Member
Posts: 8
Joined: Wed Jan 14, 2009 1:58 am

Re: how to add prefix www to URL permanently

Post by coolji »

Yes, there was www. missing in the config.php. It has been added.

But I still need to add the following in .htaccess to make it fully work.

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


Now Google has accepted my sitemap. I guess when I added URL redirect in .htacccess, it took a while to update in Google. Now everything works fine.
User avatar
M@rtijn
Power Poster
Power Poster
Posts: 706
Joined: Sat Nov 14, 2009 4:54 pm

Re: how to add prefix www to URL permanently

Post by M@rtijn »

So this question is resolved?

Maybe could you edit the first post so it shows [solved] in the title?
Thank you!
Make your community a better place!
Locked

Return to “[locked] Installation, Setup and Upgrade”