View Full Version : Subdomains and Redirecting
Rodzilla
07-27-2003, 01:58 PM
I currently have both forums.seriouscommunity.com and forums.seriouszone.com setup to point to my website's message boards. Most people are using forums.seriouscommunity.com, but I would like to change it to forums.seriouszone.com. Is there a way to set it up so that anyone going to a page on forums.seriouscommunity.com, i.e. forums.seriouscommunity.com/online.php, is automatically redirected to forums.seriouszone.com/online.php?
Gade Terbob
07-27-2003, 06:27 PM
The only thing I can think of us unpark (separate) the 2 and then setup an meta or htaccess forward to forums.seriouszone.com
Rodzilla
07-31-2003, 11:27 AM
After working with mod_rewrite for a few hours I finally got something working. I figured I'd post it here in case anyone else is interested..
.htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} forums.seriouscommunity.com
RewriteRule ^(.*)$ http://forums.seriouszone.com/$1 [R=301]
Go to http://forums.seriouscommunity.com/index.php as an example of what it does.
Gade Terbob
07-31-2003, 03:26 PM
What does the [R=302] do??
OBTW, your thread on .htaccess and hotlinking saved my bacon last week. Thanks!!!
Rodzilla
07-31-2003, 09:42 PM
That sets a header as an HTTP code 302 redirect. Basically this lets everything know the old URL is out of use and to use the new one.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
Heh..upon checking that page I realized I mixed up 302 and 301 http codes 301 is permenant (and I've updated my .htaccess file to reflect that), 302 is temporary.
10.3.2 301 Moved Permanently
The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. This response is cacheable unless indicated otherwise.
The new permanent URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s).
If the 301 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.
Note: When automatically redirecting a POST request after
receiving a 301 status code, some existing HTTP/1.0 user agents
will erroneously change it into a GET request.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.