.htaccess, mod_rewrite, and multiple domain extensions

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
User avatar
Mark Oates
Forum Newbie
Posts: 4
Joined: Wed Dec 03, 2008 3:52 am

.htaccess, mod_rewrite, and multiple domain extensions

Post by Mark Oates »

I have a website http://www.allmusiclibrary.com, and also own the .org, and .net extensions for this domain. I of course have all of the domains display the same information, however if I type in .org I want to rewrite the domain to .com in the address bar.

I've only been able to find information on rewriting for old urls, but this doesn't change the url in the address bar. I want to "correct" what's in there, any help is appreciated.
User avatar
Peter Anselmo
Forum Commoner
Posts: 58
Joined: Wed Feb 27, 2008 7:22 pm

Re: .htaccess, mod_rewrite, and multiple domain extensions

Post by Peter Anselmo »

The way I handle this (and others may have different methods) is to not involve apache, but simply have my domain registrar forward the domains to the one I want to display. I'm not sure if that's the most SEO friendly way, but it's certainly easy.
User avatar
Mark Oates
Forum Newbie
Posts: 4
Joined: Wed Dec 03, 2008 3:52 am

Re: .htaccess, mod_rewrite, and multiple domain extensions

Post by Mark Oates »

hmm, I'm looking for the most SEO friendly way. Personally, I could care less if other people see org/net, but I'm squeasing the SEO juice out.

I'm doin it fur teh SEOs. 8O
aschlosberg
Forum Newbie
Posts: 24
Joined: Fri Jan 23, 2009 10:17 pm

Re: .htaccess, mod_rewrite, and multiple domain extensions

Post by aschlosberg »

I'm not sure that the syntax is exactly correct but try something like this:

Code: Select all

 
RewriteCond %HTTP_HOST yourdomain\.(net|org)$
RewriteRule (.*) http://yourdomain.com$1
 
blenderheadStudios
Forum Newbie
Posts: 1
Joined: Thu Jan 14, 2010 6:33 pm

Re: .htaccess, mod_rewrite, and multiple domain extensions

Post by blenderheadStudios »

You should use a 301 status code redirect, because it will transfer the link equity from your previous URL to your new one. (301 is a permanent redirect).
Post Reply