View Full Version : redirect using .htaccess and ModRewrite
tomyknoker
06-04-2006, 04:49 AM
Hi All,
I am having a massive issue trying to re-direct my site. I can get modRewrite working on my server but this is exactly what i need to happen.
I have 2 domains pointing to my server:
http://www.domain.com (primary domain)
http://www.domain.com.au
If a user types in http://www.domain.com.au, I want it to automatically re-direct to http://www.domain.com... I know I do this using .htaccess and modRewrite just not sure of the exact code...
Any help would be fantastic! As I am stuck!
Thanks,
Tom
djr33
06-04-2006, 06:47 AM
.htacess? you could just use php headers, or a meta tag. might be easier.
Unless you're doing this so that
domain1.com/particularpage.htm
will redirect to
domain2.com/particularpage.htm
If you do want the exact location transferred, not sure how this works. you might be on the right track.
Sorry, but I don't really know how to help with htaccess. good luck, though.
if you did just want the second domain's index to transfer people, you could just use this, though:
<meta http-equiv="refresh" content="0;url=http://www.domain.com">
Put that in the header section, and you're done. 0 is the delay, in seconds, so for immediate redirect, use that.
mwinter
06-07-2006, 05:47 PM
If a user types in http://www.domain.com.au, I want it to automatically re-direct to http://www.domain.com... I know I do this using .htaccess and modRewrite just not sure of the exact code...You needn't go as far as using mod_rewrite, and even if you did, mod_rewrite works very differently at a per-directory level (.htaccess) than it does in the server configuration file. The Redirect directive should suffice:
Redirect permanent / http://www.domain.com/
Hope that helps,
Mike
tomyknoker
10-17-2006, 01:37 AM
Hi Mike,
SO where about's do I put the code you spoke of? Does it go into a .htaccess file?
mwinter
10-19-2006, 04:06 PM
SO where about's do I put the code you spoke of? Does it go into a .htaccess file?
Yes, though the main server configuration file would be better.
Mike
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.