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

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
gurke
Posts: 89
Joined: Tue 7. Jun 2005, 20:45

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

Post 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
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

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

Post by update »

It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
gurke
Posts: 89
Joined: Tue 7. Jun 2005, 20:45

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

Post 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!
Post Reply