RE: [users@httpd] redirect debacle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx] 
Sent: Thursday, April 13, 2006 2:15 AM
To: users@xxxxxxxxxxxxxxxx
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@xxxxxxxxx>
>Reply-To: users@xxxxxxxxxxxxxxxx
>To: users@xxxxxxxxxxxxxxxx
>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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux