Request help with .htaccess mod_rewrite processing

This is a discussion on Request help with .htaccess mod_rewrite processing within the Apache Web Server forums, part of the Web Server and Related Forums category; Appreciate some guidance here with a mod_rewrite problem. I am running HTTP server 2.2.4 with mod_rewrite on Windows ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 5 Days Ago
Dino
 
Posts: n/a
Default Request help with .htaccess mod_rewrite processing

Appreciate some guidance here with a mod_rewrite problem.

I am running HTTP server 2.2.4 with mod_rewrite on Windows XP (and
have reproduced the same behavior on Linux).

I am confident that mod_rewrite is installed and my .htaccess file is
being read because it has several rewrite rules that are clearly being
invoked.

One of the rules I need is a simple rewrite to change any path that
starts with /users to be /members instead.

The .htaccess file is in the DocumentRoot. The rule I have at present
is:

RewriteRule ^members(.*)$ users$1 [NC]

However the path /members/login/candidates/edit gets rewritten to
users/login/candidates/edit/login/candidates/edit

The relevant portion of the rewrite log file follows:


[perdir C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/
cake/app/webroot/] applying pattern '^members(.*)' to uri 'members/
login/candidates/edit'
127.0.0.1 - - [07/May/2008:12:07:54 --0500] [localhost/sid#6af208]
[rid#1025578/initial] (2) [perdir C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/cake/app/webroot/] rewrite 'members/login/
candidates/edit' -> 'users/login/candidates/edit'
127.0.0.1 - - [07/May/2008:12:07:54 --0500] [localhost/sid#6af208]
[rid#1025578/initial] (3) [perdir C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/cake/app/webroot/] add per-dir prefix:
users/login/candidates/edit -> C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/cake/app/webroot/users/login/candidates/
edit
127.0.0.1 - - [07/May/2008:12:07:54 --0500] [localhost/sid#6af208]
[rid#1025578/initial] (3) [perdir C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/cake/app/webroot/] add path info postfix:
C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/cake/app/
webroot/users/login/candidates/edit -> C:/Program Files/Apache
Software Foundation/Apache2.2/htdocs/cake/app/webroot/users/login/
candidates/edit/login/candidates/edit
127.0.0.1 - - [07/May/2008:12:07:54 --0500] [localhost/sid#6af208]
[rid#1025578/initial] (3) [perdir C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs/cake/app/webroot/] strip per-dir prefix:
C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/cake/app/
webroot/users/login/candidates/edit/login/candidates/edit -> users/
login/candidates/edit/login/candidates/edit
127.0.0.1 - - [07/May/2008:12:07:54 --0500] [localhost/sid#6af208]
[rid#1025578/initial] (3)

I have tried several variations with and without a leading slash on
the substitution string and with a RewriteBase / directive, but
without success. I am sure I am missing something simple. Any help
really appreciated.
  #2 (permalink)  
Old 5 Days Ago
Dino
 
Posts: n/a
Default Re: Request help with .htaccess mod_rewrite processing

Seem to have resolved the problem by adding [L] as a flag. This seems
to stop the postfix processing. Havent seen any clear documentation
on why this works this way, so would still be interested in an
explanation that would increase my confidence that this is the right
solution.
  #3 (permalink)  
Old 14 Hours Ago
Joachim Ritschmann
 
Posts: n/a
Default Re: Request help with .htaccess mod_rewrite processing

Hi,

I think a slash between directory and rest of the path should help:
=> RewriteRule ^members/(.*)$ users/$1 [NC]
Without the slash, members AND any other part of the path is replaced, then
the request path is added again.

Ritschi =B-)


"Dino" <ilopata1@hotmail.com> schrieb im Newsbeitrag
news:91332bf4-bf42-4fc5-8015-37bce70fb533@w7g2000hsa.googlegroups.com...
> Seem to have resolved the problem by adding [L] as a flag. This seems
> to stop the postfix processing. Havent seen any clear documentation
> on why this works this way, so would still be interested in an
> explanation that would increase my confidence that this is the right
> solution.



 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:27 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0