Domain Alias and redirect

Using a single web hosting account to host multiple sites

Domain Alias and redirect

Postby kindofabigdeal » Thu Apr 24, 2008 2:14 pm

So I have my-domain.net and my-domain.tv ...
Both of them use the same host and are set up as aliases. When going to the main page of either the root index shows up.

What I want to happen is when a user goes to my-domain.tv it will redirect the user (and change the url) to my-domain.net/tv


I have this to work with, but it doesn't change the URL for me:

Code: Select all
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?my-domain\.tv$ [NC]
RewriteRule ^(.*)$ /tv/$1 [QSA,L]



Any help would be greatly appreciated
kindofabigdeal
 
Posts: 3
Joined: Thu Apr 24, 2008 1:57 pm

Postby richardk » Thu Apr 24, 2008 2:17 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?example\.tv$ [NC]
RewriteRule ^(.*)$ http://www.example.net/tv/$1 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby kindofabigdeal » Thu Apr 24, 2008 5:37 pm

hey man thanks for the quick response.


This works great for the root, but when I go to my-domain.tv/folder for example, I'd like for it redirect to my-domain.net/tv/folder
kindofabigdeal
 
Posts: 3
Joined: Thu Apr 24, 2008 1:57 pm

Postby richardk » Sat Apr 26, 2008 2:50 pm

It should work for any .tv URL. It won't change the links in the page, though, could that be the problem?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby kindofabigdeal » Sat Apr 26, 2008 4:21 pm

If I just type in a .tv/subdir URL it will not redirect. If I go to the main .tv url with no subdir it works, otherwise no redirect :(
kindofabigdeal
 
Posts: 3
Joined: Thu Apr 24, 2008 1:57 pm

Postby richardk » Tue Apr 29, 2008 9:33 am

Well the mod_rewrite matches any URL, so you will need to ask your host.

Do you have any other rules?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 2 guests

cron