htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Redirect Main Domain to Subdomain
PostPosted: 23 Jul 2008 15:14 
Offline

Joined: 23 Jul 2008 14:53
Posts: 1
Hello folks,

My problem is rather easy to explain but unfortunately I couldn't find any solution for it:

I would like to redirect my domain "lastname.net" to the subdomain "firstname.lastname.net" using htaccess (simply because there are plenty of people with my last name and I want them to know that it's actually me :)) Anyway, I don't want to move all my files (located in the main root directory) to the subdomain or a separate folder in my root (like "lastname.net/mydir"). All I want is that the url the browser shows is "firstname.lastname.net/xyz" whenever people enter http://www.lastname.net/xyz or also lastname.net/xyz. What do I need to change in order to do that? If I take out the additional folder "/mydir" and replace it only with "/" it doesn't work...Here's the code:

Code:
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^www.lastname.net$ [OR]
RewriteCond %{HTTP_HOST} ^lastname.net$
RewriteRule ^mydir(.*)$ http://firstname.lastname.net$1 [R,L]

RewriteCond %{HTTP_HOST} ^firstname.lastname.net$
RewriteCond %{REQUEST_URI} !^/mydir
RewriteRule ^(.*)$ mydir/$1 [L]


Thanks a lot!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB