changing domains

Using a single web hosting account to host multiple sites

changing domains

Postby libby » Mon Jan 29, 2007 10:27 pm

I am just dipping my toes into the mod_rewrite pool and I wonder if you can help me. I'm not sure if this is possible:


I have a large html site that I am migrating over to a cms. Most of the older stuff on the site is going to stay as html but I can going to give it a new domain name and transfer the current domain to the cms site. Now some of the old pages have absolute links and I want to rewrite all those links to the new domain, so that if we come across a link to Http://www.htmlsite.com/filename I want it to be re-directed to Http://www.newdomainname.com/filename

Is that possible with mod_rewrite?
libby
 
Posts: 3
Joined: Mon Jan 29, 2007 10:24 pm

Postby richardk » Tue Jan 30, 2007 11:14 am

Mod_rewrite doesn't actually change anything, it works on the incoming requests, so it'll need to be on the old domain, and will just redirect to the HTML site.

Do all the paths you want redirecting have something in common (or a few things, like being .html) that's also different to the new links?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby libby » Tue Jan 30, 2007 11:32 am

yes, all the links have the .stm file suffix ... will that help?
libby
 
Posts: 3
Joined: Mon Jan 29, 2007 10:24 pm

Postby richardk » Tue Jan 30, 2007 12:06 pm

Try putting the following in a .htaccess file in the document root of the old domain:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(.+\.stm)$ http://the-new-domain.com/$1 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby libby » Tue Jan 30, 2007 10:07 pm

many thanks - I will try it
libby
 
Posts: 3
Joined: Mon Jan 29, 2007 10:24 pm


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 23 guests

cron