httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Axel-St├ęphane SMORGRAV <Axel-Stephane.SMORG...@europe.adp.com>
Subject RE: [users@httpd] redirect debacle
Date Thu, 13 Apr 2006 06:12:38 GMT
Make sure you have loaded mod_rewrite.

If you really need the client to request a specific host name (because you are using named
virtual hosts), you can put the following lines in the appropriate virtual host:

RewriteEngine On
RewriteCond %{HTTP_HOST} =csquared.stanford.edu 
RewriteRule .* http://wilkinson.stanford.edu/csquared/ [R] 

If you want to have fun, you can also make a more general rule that redirects any request
to your site with a host name other than wilkinson.stanford.edu, to wilkinson using the host
name as first element of the path:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^\.]+).stanford.edu 
RewriteCond %1 !=wilkinson
RewriteRule .* http://wilkinson.stanford.edu/%1/ [R] 


No Redirect directive required. The one suggested would redirect all requests for the root
path to wilkinson, and would most probably result in a redirect loop.

-ascs


-----Original Message-----
From: Paul Constantine [mailto:paulconstantine@hotmail.com] 
Sent: Thursday, April 13, 2006 2:15 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] redirect debacle

Perhaps you could give me some hints for doing this with mod_rewrite, if you have previous
experience? It looks quite involved.

Thanks again,
Paul


>From: "Kishore Jalleda" <kjalleda@gmail.com>
>Reply-To: users@httpd.apache.org
>To: users@httpd.apache.org
>Subject: Re: [users@httpd] redirect debacle
>Date: Wed, 12 Apr 2006 19:05:08 -0400
>
>I guess you need the Rewrite directive for what you are trying to 
>acheive, as far as the syntax for Redirect goes
>
>                             Redirect [status] URL-path URL
>
>notice that the second argument is a URL-path which is supposed to be 
>PATH (absolute or relative), and not a URL like you defined.
>
>There are two walk arounds for this
>
>1) Go into the config section of http://csquared.stanford.edu/, and do this
>Redirect permanent    /   http://wilkinson.stanford.edu/csquared/
>
>2) Or use Mod_Rewrite to rewrite the URL

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message