Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Routing SUPPORT.blah.com to blah.com/support.html

Status
Not open for further replies.

EdwardMartinIII

Technical User
Sep 17, 2002
1,655
US
If I want support.blah.com to direct to blah.com, is that something I do on the server side? How might I do that?

Thanks!


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Actually it's a bit more than that. First make sure your mod_rewrite module is being loaded...
Code:
LoadModule rewrite_module modules/mod_rewrite.so
Then it needs to be turned on...
Code:
RewriteEngine on
RewriteLog  /path/to/log/httpd_rewrite
RewriteLogLevel 0
Then the rules to catch "support.blah.com"...
Code:
RewriteCond  %{HTTP_HOST}  ^support.blah.com$    [NC]
RewriteRule  ^(.*)$        [URL unfurl="true"]http://blah.com/support.html[/URL] [R=301,L]
As you are testing, increase the RewriteLogLevel to get more information. The log file entries should help you debug what's going on.
 
Sorry for being a little dense, but I'm pretty new to this aspect of webbery.

Is this something I put in the .htaccess file, or something I execute once from a command line, or what?

Thanks!


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Sorry, might not have asked that right.

This code is something that goes into the .htaccess file, or somewhere else?



[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
...okay, I think so, based on more reading...


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Holy chrome -- that Server Error 500'd the whole site!

Dang!

Good thing I could reverse it before my boss saw.

So, what's am I doing wrong? My .htaccess file contains this:

Code:
ErrorDocument 404 [URL unfurl="true"]http://www.blah.com/Error404.html[/URL]
ErrorDocument 403 [URL unfurl="true"]http://www.blah.com/Error404.html[/URL]
Options -Indexes
<Files .htaccess>
order allow,deny
deny from all
</Files>

AddHandler server-parsed .html

Redirect permanent (a list of redirects...)

and I changed it to this:

Code:
ErrorDocument 404 [URL unfurl="true"]http://www.blah.com/Error404.html[/URL]
ErrorDocument 403 [URL unfurl="true"]http://www.blah.com/Error404.html[/URL]
Options -Indexes
<Files .htaccess>
order allow,deny
deny from all
</Files>

AddHandler server-parsed .html

LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine on
RewriteLog  /path/to/log/httpd_rewrite
RewriteLogLevel 0
RewriteCond  %{HTTP_HOST}  ^support.blah.com$    [NC]
RewriteRule  ^(.*)$        [URL unfurl="true"]http://blah.com/support_request.html[/URL] [R=301,L]

Redirect permanent (a list of redirects...)

Am I missing something?



[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top