|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Clarification of mod_rewrite's RewriteRule is needed.
Greetings.
Apache Guru help need. I ask a clarification for the following. I'm using the .htaccess in some dir ---========== RewriteEngine On RewriteRule ^AAA/(.+)$ BBB/$1 [NC] RewriteRule ^BBB/(.+)$ CCC/$1 [NC] RewriteRule ^CCC/(.+).html$ nph-page.php?ps=$1[NC] ---========== Which accidently rewrites the /AAA/some.html into nph-page.php?ps=some.html/some.html/some I expect to receive page.php?ps=some.html not triple of them the mod_rewrite.log is ---========== 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] add path-info postfix: t:/html/httpdocs/content/aaa -> t:/html/httpdocs/content/aaa/index.html 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] strip per-dir prefix: t:/html/httpdocs/content/aaa/index.html -> aaa/index.html 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] applying pattern '^AAA/(.+)$' to uri 'aaa/index.html' 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (2) [per-dir t:/html/httpdocs/content/] rewrite aaa/index.html -> BBB/index.html 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] add per-dir prefix: BBB/index.html -> t:/html/httpdocs/content/BBB/index.html 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] add path-info postfix: t:/html/httpdocs/content/BBB/index.html -> t:/html/httpdocs/content/BBB/index.html/index.html 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] strip per-dir prefix: t:/html/httpdocs/content/BBB/index.html/index.html -> BBB/index.html/index.html 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] applying pattern '^BBB/(.+)$' to uri 'BBB/index.html/index.html' 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (2) [per-dir t:/html/httpdocs/content/] rewrite BBB/index.html/index.html -> CCC/index.html/index.html 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] add per-dir prefix: CCC/index.html/index.html -> t:/html/httpdocs/content/CCC/index.html/index.html 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] add path-info postfix: t:/html/httpdocs/content/CCC/index.html/index.html -> t:/html/httpdocs/content/CCC/index.html/index.html/index.html 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] strip per-dir prefix: t:/html/httpdocs/content/CCC/index.html/index.html/index.html -> CCC/index.html/index.html/index.html 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] applying pattern '^CCC/(.+).html$' to uri 'CCC/index.html/index.html/index.html' 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (2) [per-dir t:/html/httpdocs/content/] rewrite CCC/index.html/index.html/index.html -> nph-page.php?ps=index.html/index.html/index 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) split uri=nph--page.php?ps=index.html/index.html/index -> uri=nph-page.php, args=ps=index.html/index.html/index 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] add per-dir prefix: nph-page.php -> t:/html/httpdocs/content/nph-page.php 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (2) [per-dir t:/html/httpdocs/content/] strip document_root prefix: t:/html/httpdocs/content/nph-page.php -> /content/nph-page.php 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (1) [per-dir t:/html/httpdocs/content/] internal redirect with /content/nph-page.php [INTERNAL REDIRECT] 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e5d38/initial/redir#1] (3) [per-dir t:/html/httpdocs/content/] strip per-dir prefix: t:/html/httpdocs/content/nph-page.php -> nph-page.php 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e5d38/initial/redir#1] (3) [per-dir t:/html/httpdocs/content/] applying pattern '^AAA/(.+)$' to uri 'nph-page.php' 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e5d38/initial/redir#1] (3) [per-dir t:/html/httpdocs/content/] strip per-dir prefix: t:/html/httpdocs/content/nph-page.php -> nph-page.php 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e5d38/initial/redir#1] (3) [per-dir t:/html/httpdocs/content/] applying pattern '^BBB/(.+)$' to uri 'nph-page.php' 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e5d38/initial/redir#1] (3) [per-dir t:/html/httpdocs/content/] strip per-dir prefix: t:/html/httpdocs/content/nph-page.php -> nph-page.php 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e5d38/initial/redir#1] (3) [per-dir t:/html/httpdocs/content/] applying pattern '^CCC/(.+).html$' to uri 'nph-page.php' 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e5d38/initial/redir#1] (1) [per-dir t:/html/httpdocs/content/] pass through t:/html/httpdocs/content/nph-page.php ---====== the problem is 127.0.0.1 - - [27/Sep/2005:20:37:21 +0400] [www.domain.com/sid#868d40][rid#25e0398/initial] (3) [per-dir t:/html/httpdocs/content/] add path-info postfix: t:/html/httpdocs/content/BBB/index.html -> t:/html/httpdocs/content/BBB/index.html/index.html When I add options [L] or [PT] to the rules in .htaccess the problem disappears. Could anyone clarify me why without [L] or [PT] options Apache works a bit odd from my point of view. Thanks. |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Web Server Configuration > Clarification of mod_rewrite's RewriteRule is needed. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|