thisdomain/* to thatdomain/*

Using a single web hosting account to host multiple sites

thisdomain/* to thatdomain/*

Postby cyk » Fri Feb 16, 2007 1:12 pm

I currently host petemc.net as my photoblog. I have bought vanilladays.com as the new name for the site. Ideally I'd like it when people visit any page on petemc.net to change to vanilladays.com. For example;

petemc.net/gallery/2007/01/quiggins/ becomes vanilladays.com/gallery/2007/01/quiggins/

At the moment I've managed to get a redirect for the domain only with;

RewriteCond %{HTTP_HOST} ^petemc\.net$ [NC]
RewriteRule ^(.*)$ http://www.vanilladays.com/ [R=301,L]

I can't get it working for any actual page though. Any ideas would be appreciated, thanks.
cyk
 
Posts: 3
Joined: Fri Feb 16, 2007 1:08 pm

Postby richardk » Fri Feb 16, 2007 4:06 pm

Code: Select all
Redirect 301 / http://www.vanilladays.com/


Or with mod_rewrite:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

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

Postby cyk » Fri Feb 16, 2007 4:12 pm

Hmmm I get an internal server error 500 with that code and this in my logs;

RewriteCond: bad flag delimiters

I get a firefox redirects message for the first bit of code too :(
cyk
 
Posts: 3
Joined: Fri Feb 16, 2007 1:08 pm

Postby richardk » Fri Feb 16, 2007 4:24 pm

There's nothing wrong with it. Just add the (www\.)? and $1 to your original.

If you're using a Mac it might be the line breaks, then create the .htaccess file on the server (or change your editor to use Unix/Windows style line breaks).
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby cyk » Fri Feb 16, 2007 4:37 pm

Ah ha. Got it working. I think it may have been some other code in there causing the problem. I started from scratch and its fine. Thanks for your help :)
cyk
 
Posts: 3
Joined: Fri Feb 16, 2007 1:08 pm


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 15 guests

cron