Page 1 of 1
How to specify www vs. non-www - with Pretty URLS - on new install?
Posted: Wed May 13, 2009 5:54 am
by WebGirl
Not sure if this is the right location for this question.
Installation: CMSMS 1.5.4
PHP: Ver 5
My client wants to only see 'www' in her site's URL, which is normally achieved by amending the htaccess file
I've been advised to add this to the .htaccess:
--
RewriteEngine on
RewriteCond %{HTTP_HOST} ^
website-name.com [NC]
RewriteRule ^(.*)$
http://www.
website-name.com/$1 [L,R=301]
--
Of course I replaced '
website-name.com' - with the real live website name
I had already set up Pretty URLs, so once I added this, the Pretty URLs stopped working, and I could no longer login to the Admin.
Does anyone know of the best way to implement (1) Pretty URLS, with (2) 'www' - either using .htaccess or some other way?
I really have no knowledge of how to write the .htaccess apart from using it for Pretty URLs.
Any assistance is greatly appreciated!
Many thanks
Re: How to specify www vs. non-www - with Pretty URLS - on new install?
Posted: Wed May 13, 2009 10:33 am
by Jean le Chauve
Hi,
Code: Select all
RewriteCond %{HTTP_HOST} ^domaine.com$ [NC]
RewriteRule ^(.*)$ http://www.domaine.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^.*domaine.com [NC]
RewriteRule (.*) http://www.domaine.com/$1 [R=301,L]
config.php :
$config['assume_mod_rewrite'] = true;
$config['page_extension'] = '.html';
$config['internal_pretty_urls'] = false;
$config['use_hierarchy'] = true; //optional
$config['root_url'] = '
http://www.domaine.com';
Re: How to specify www vs. non-www - with Pretty URLS - on new install?
Posted: Wed May 13, 2009 11:55 am
by WebGirl
Merci Jean!
OK just so I've got this right - this goes in
.htaccess:
and this goes in
config.php :
$config['assume_mod_rewrite'] = true;
$config['page_extension'] = '.html';
$config['internal_pretty_urls'] = false;
$config['use_hierarchy'] = true; //optional
$config['root_url'] = '
http://www.domaine.com';
Fantastique! I'll give that a shot!
Thanks a million!
Re: How to specify www vs. non-www - with Pretty URLS - on new install?
Posted: Wed May 13, 2009 9:11 pm
by viebig
or you can just change
Code: Select all
$config['root_url'] = 'http://www.domaine.com';
to
Code: Select all
$config['root_url'] = 'http://domaine.com';
no htaccess changes
Regards
Re: How to specify www vs. non-www - with Pretty URLS - on new install?
Posted: Sun May 17, 2009 8:47 am
by Jean le Chauve
Jean le Chauve wrote:
Hi,
Code: Select all
RewriteCond %{HTTP_HOST} !^.*domaine.com [NC]
RewriteRule (.*) http://www.domaine.com/$1 [R=301,L]
Edit : this 2 lines make a second redirection => bad
Re: How to specify www vs. non-www - with Pretty URLS - on new install?
Posted: Tue May 19, 2009 12:15 am
by WebGirl
Thank you everyone for trying to help.
I cannot solve this.
I have spent days tweaking the htaccess and config.php files, I've checked the templates, and still this issue cannot be resolved. I have paid someone else to investigate it (a cmsms person).
This client website had the 'www' working AND Pretty URLS in version 1.1, but now we've upgraded to 1.5.4 nothing can put this back the way it was.
The client's request is simply that if someone types their domain name without the 'www', that it should always resolve to the 'www' version. This is for Google search engine, webmaster and analytics - so there is no 'duplicate content' on a non-www version of the site.
Unfortunately I have had to tell the client that she cannot have both www and pretty urls in CMSMS 1.5.4.

Re: How to specify www vs. non-www - with Pretty URLS - on new install?
Posted: Tue May 19, 2009 12:59 am
by nuno
Like
viebig said put this in your config.php
$config['root_url'] = '
http://www.domaine.com';
http://www.domaine.com is your domain ofcourse
Done
Re: How to specify www vs. non-www - with Pretty URLS - on new install?
Posted: Tue May 19, 2009 1:50 am
by WebGirl
Hi Nuno,
Yes I have done that.
Thanks
