You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "John H. Nyhuis" <ca...@u.washington.edu> on 2006/08/26 02:04:09 UTC

[users@httpd] 301 redirect with mod_rewrite? Possible to use relitive paths rather then FQDN paths?

 	I was wondering if anyone has given thought to allowing the use of 
relative paths with the mod_rewrite package rather then requiring full 
paths.  i.e., in the .htaccess file:

"Redirect 301 ./neuro.asp ../neurology.php" (does not work)

instead of:

"Redirect 301 /pedtest/divisions/neuro/neuro.asp 
http://depts.washington.edu/pedtest/divisions/neurology.php"

(does work)

Just asking because our dev->testing->production setup has different 
absolute FQDN's at each spot, and this means the .htaccess file is 
specific to each of the environments.  It would be convenient to not have 
to remember to change the .htaccess file each time a new site version gets 
pushed through the process.

 	Thanks,

John H. Nyhuis
Sr. Computer Specialist
Dept. of Pediatrics
HS RR338, Box 356320
University of Washington
Desk: (206)-685-3884
cabal@u.washington.edu


---------------------------------------------------------------------
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


Re: [users@httpd] 301 redirect with mod_rewrite? Possible to use relitive paths rather then FQDN paths?

Posted by Joshua Slive <jo...@slive.ca>.
On 8/25/06, John H. Nyhuis <ca...@u.washington.edu> wrote:
>         I was wondering if anyone has given thought to allowing the use of
> relative paths with the mod_rewrite package rather then requiring full
> paths.  i.e., in the .htaccess file:
>
> "Redirect 301 ./neuro.asp ../neurology.php" (does not work)
>
> instead of:
>
> "Redirect 301 /pedtest/divisions/neuro/neuro.asp
> http://depts.washington.edu/pedtest/divisions/neurology.php"
>
> (does work)
>
> Just asking because our dev->testing->production setup has different
> absolute FQDN's at each spot, and this means the .htaccess file is
> specific to each of the environments.  It would be convenient to not have
> to remember to change the .htaccess file each time a new site version gets
> pushed through the process.

You can't use relative paths, but you can accomplish the same thing:
RewriteRule (.*)(/[^/]*)/neuro.asp $1/neurology.php [R=301]

(That may need to be adjusted, but it should give you the idea.)

Joshua.

---------------------------------------------------------------------
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