homepage Welcome to WebmasterWorld Guest from 54.224.202.109
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
301 redirect domains to subpages
301 redirection of multiple domains to subpages of site
mediafrenzy




msg:1512534
 9:54 pm on May 2, 2006 (gmt 0)

I'm needing some advice on 301 redirection of multiple domain names to subpages of my main website.

Here's the situation, I have a domain -

example.com

I now also have 3 extra domains which need to 301 redirect to subpages of example.com, eg

subsite1.com --> example.com/subsite1.html
subsite2.com --> example.com/subsite2.html
subsite3.com --> example.com/subsite3.html

I'm just not sure how I should go about doing this without setting up 3 extra domain accounts on my server, and placing a seperate 301 redirect in the root of each?!

 

UserFriendly




msg:1512535
 1:00 am on May 3, 2006 (gmt 0)

For my site, I found that Apache's mod_rewrite function set did the job.

I have two domains and a host-provided subdomain. Using the RewriteCond and RewriteRule functions in my top-level .htaccess file allowed me to force a redirect whenever a visitor was trying to see my site using any URL other than my preferred one.

You ought to be able to use the same functions to alter the URL that your visitors go to. You can even use mod_rewrite to silently modify the URL that pages are fetched from, without causing the user's browser to redirect.

However, mod_rewrite must be compiled into Apache for you to use it, and it's not a simple set of functions. Make sure you read all about it before you edit your .htaccess file. (Of course, if you have access to the server config files, you'll edit those instead.)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved