Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 03:59:43 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155544 Posts in 21715 Topics by 7737 Members
Latest Member: simpleguy3
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: .htaccess 301 domain redirect doesn't work!  (Read 363 times)
Housy

Offline Offline

Posts: 39



« on: March 22, 2011, 08:02:10 PM »

Hi grin

Can someone please tell me, what would be the right code for none www to www domain redirect?

At the moment i'm using the code below, but it doesn't work. It does redirect from none www to www domain but the problem here is, that i can't login into admin area, if i use that code, because i'm always redirected to www.my-domain.net/admin/login/index.php

Code:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^my-domain.net [nc]
rewriterule ^(.*)$ http://www.my-domain.net/$1 [r=301,nc]

I also want a redirect for index.php, so if the user visits site like this -> www.domain.net/index.php, he is redirected to www.domain.net. I tried with the code below and it does work but, i can't login into admin then, because i'm always redirected to www.my-domain.net/admin/login/index.php

Code:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.my-domain.net/ [R=301,L]

So what am i doing wrong?

Thanks, Housy
« Last Edit: March 22, 2011, 08:06:50 PM by Housy » Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2297



WWW
« Reply #1 on: March 22, 2011, 11:18:24 PM »

I am afraid this is not the right place to look for an answer to this.
This forum is about WB related issues.

The rewrite for adding/removing www in domains will give a few million results in Google. Please use the info you find there.
Logged

Professional WebsiteBaker Solutions
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!