Page 1 of 1

redirect http://domainname.de to http://www.domainname.de

Posted: Sun 6. Apr 2008, 12:39
by gurke
Hi everrybody,

i have the following problem. im using the rewrite engine so that URLs like index.php?bla are being transformed into bla.phtml.
thats great. but i also wanted to redirect all URLs without www in it to the one with www in it, for example:

http://domainname.de to http://www.domainname.de

Therefore i included the following code in my htaccess:
RewriteCond %{HTTP_HOST} domainname\.de$
RewriteCond %{HTTP_HOST} !www\.domainname\.de$
RewriteRule ^(.*)$ http://www.domainname.de/$1 [L,R=301]

Now that works perfectly for the index page:
http://domainname.de to http://www.domainname.de

But other pages like http://domainname.de/bla.phtml are being redirected to http://www.domainname.de/index.php?bla and not http://www.domainname.de/bla.phtml

How can i manage that? Anyone an idea?

Thanks, gurke

Re: redirect http://domainname.de to http://www.domainname.de

Posted: Mon 7. Apr 2008, 14:24
by update

Re: redirect http://domainname.de to http://www.domainname.de

Posted: Mon 7. Apr 2008, 15:36
by gurke
Problem is solved. I put my code at the end of the htaccess file.
When you put it at the beginning (ie before the phpwcms rewrite rules) it works properly.

Thanks!