我在修理。我对RewriteRule
文件中的htaccess
做了一些小改动,现在,我的网站上没有一个页面可以正常使用。
以前的规则,一切正常
RewriteEngine on
RewriteRule ^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$ /documents/?type=$1&document=$2 [NC,L]
#country/category
RewriteRule ^/?([a-z]{2})/([a-z-]+)/?$ /display/?c=$1t=$2 [NC,L] // This line has the change
#No country or category specified
RewriteRule ^/?$ /display/ [NC,L]
当前改变的规则打破了一切
RewriteEngine on
RewriteRule ^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$ /documents/?type=$1&document=$2 [NC,L]
#category
RewriteRule ^/?([a-z-]+)/?$ /display/?t=$1 [NC,L] // Notice, I removed the country here
#No category specified
RewriteRule ^/?$ /display/ [NC,L]
如果删除最后两条规则,那么工作正常。
此htaccess文件位于根目录中。有谁知道是什么原因导致这种情况以及如何纠正?
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1837108/initial] (3) [perdir C:/web/apache/htdocs/test/] add path info postfix: C:/web/apache/htdocs/test/document -> C:/web/apache/htdocs/test/document/about
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1837108/initial] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/document/about -> document/about
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1837108/initial] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'document/about'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1837108/initial] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'document/about' -> '/documents/?type=document&document=about'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1837108/initial] (3) split uri=/documents/?type=document&document=about -> uri=/documents/, args=type=document&document=about
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1837108/initial] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /documents/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1843630/initial/redir#1] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/documents/ -> documents/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1843630/initial/redir#1] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'documents/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1843630/initial/redir#1] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/documents/ -> documents/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1843630/initial/redir#1] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'documents/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1843630/initial/redir#1] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'documents/' -> '/display/?t=documents'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1843630/initial/redir#1] (3) split uri=/display/?t=documents -> uri=/display/, args=t=documents
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1843630/initial/redir#1] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1847008/initial/redir#2] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1847008/initial/redir#2] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1847008/initial/redir#2] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1847008/initial/redir#2] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1847008/initial/redir#2] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1847008/initial/redir#2] (3) split uri=/display/?t=display -> uri=/display/, args=t=display
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1847008/initial/redir#2] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1848968/initial/redir#3] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1848968/initial/redir#3] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1848968/initial/redir#3] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1848968/initial/redir#3] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1848968/initial/redir#3] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1848968/initial/redir#3] (3) split uri=/display/?t=display -> uri=/display/, args=t=display
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1848968/initial/redir#3] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18360c0/initial/redir#4] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18360c0/initial/redir#4] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18360c0/initial/redir#4] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18360c0/initial/redir#4] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18360c0/initial/redir#4] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18360c0/initial/redir#4] (3) split uri=/display/?t=display -> uri=/display/, args=t=display
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18360c0/initial/redir#4] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1849748/initial/redir#5] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1849748/initial/redir#5] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1849748/initial/redir#5] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1849748/initial/redir#5] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1849748/initial/redir#5] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1849748/initial/redir#5] (3) split uri=/display/?t=display -> uri=/display/, args=t=display
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#1849748/initial/redir#5] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#184ae10/initial/redir#6] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#184ae10/initial/redir#6] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#184ae10/initial/redir#6] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#184ae10/initial/redir#6] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#184ae10/initial/redir#6] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#184ae10/initial/redir#6] (3) split uri=/display/?t=display -> uri=/display/, args=t=display
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#184ae10/initial/redir#6] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f4588/initial/redir#7] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f4588/initial/redir#7] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f4588/initial/redir#7] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f4588/initial/redir#7] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f4588/initial/redir#7] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f4588/initial/redir#7] (3) split uri=/display/?t=display -> uri=/display/, args=t=display
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f4588/initial/redir#7] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f5ca0/initial/redir#8] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f5ca0/initial/redir#8] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f5ca0/initial/redir#8] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f5ca0/initial/redir#8] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f5ca0/initial/redir#8] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f5ca0/initial/redir#8] (3) split uri=/display/?t=display -> uri=/display/, args=t=display
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f5ca0/initial/redir#8] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f7470/initial/redir#9] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f7470/initial/redir#9] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f7470/initial/redir#9] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f7470/initial/redir#9] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f7470/initial/redir#9] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f7470/initial/redir#9] (3) split uri=/display/?t=display -> uri=/display/, args=t=display
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f7470/initial/redir#9] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f8c68/initial/redir#10] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f8c68/initial/redir#10] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f8c68/initial/redir#10] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f8c68/initial/redir#10] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f8c68/initial/redir#10] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f8c68/initial/redir#10] (3) split uri=/display/?t=display -> uri=/display/, args=t=display
127.0.0.1 - - [18/Jun/2014:23:09:05 +051800] [test.com/sid#7e48f0][rid#18f8c68/initial/redir#10] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17dd0a0/initial] (3) [perdir C:/web/apache/htdocs/test/] add path info postfix: C:/web/apache/htdocs/test/document -> C:/web/apache/htdocs/test/document/about
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17dd0a0/initial] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/document/about -> document/about
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17dd0a0/initial] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'document/about'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17dd0a0/initial] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'document/about' -> '/documents/?type=document&document=about'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17dd0a0/initial] (3) split uri=/documents/?type=document&document=about -> uri=/documents/, args=type=document&document=about
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17dd0a0/initial] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /documents/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d3670/initial/redir#1] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/documents/ -> documents/
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d3670/initial/redir#1] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'documents/'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d3670/initial/redir#1] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/documents/ -> documents/
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d3670/initial/redir#1] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'documents/'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d3670/initial/redir#1] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'documents/' -> '/display/?t=documents'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d3670/initial/redir#1] (3) split uri=/display/?t=documents -> uri=/display/, args=t=documents
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d3670/initial/redir#1] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d9050/initial/redir#2] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d9050/initial/redir#2] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d9050/initial/redir#2] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d9050/initial/redir#2] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d9050/initial/redir#2] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d9050/initial/redir#2] (3) split uri=/display/?t=display -> uri=/display/, args=t=display
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d9050/initial/redir#2] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17da9b0/initial/redir#3] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17da9b0/initial/redir#3] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17da9b0/initial/redir#3] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17da9b0/initial/redir#3] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17da9b0/initial/redir#3] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17da9b0/initial/redir#3] (3) split uri=/display/?t=display -> uri=/display/, args=t=display
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17da9b0/initial/redir#3] (1) [perdir C:/web/apache/htdocs/test/] internal redirect with /display/ [INTERNAL REDIRECT]
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d8048/initial/redir#4] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d8048/initial/redir#4] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?(document)/(about|contact|privacy|terms-of-use|updates|bugs)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d8048/initial/redir#4] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/display/ -> display/
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d8048/initial/redir#4] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^/?([a-z-]+)/?$' to uri 'display/'
127.0.0.1 - - [18/Jun/2014:23:09:17 +051800] [test.com/sid#7e48f0][rid#17d8048/initial/redir#4] (2) [perdir C:/web/apache/htdocs/test/] rewrite 'display/' -> '/display/?t=display'
由于字符限制,我无法在此处发布整个日志。我正在运行Apache 2.2.22。
更新
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#1849050/initial] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/site/scripts/testFramework.js -> site/scripts/testFramework.js
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#1849050/initial] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^' to uri 'site/scripts/testFramework.js'
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#1849050/initial] (1) [perdir C:/web/apache/htdocs/test/] pass through C:/web/apache/htdocs/test/site/scripts/testFramework.js
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#18f10d0/initial] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/site/scripts/testCore.js -> site/scripts/testCore.js
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#18f10d0/initial] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^' to uri 'site/scripts/testCore.js'
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#18f10d0/initial] (1) [perdir C:/web/apache/htdocs/test/] pass through C:/web/apache/htdocs/test/site/scripts/testCore.js
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#1851070/initial] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/site/scripts/testValidate.js -> site/scripts/testValidate.js
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#1851070/initial] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^' to uri 'site/scripts/testValidate.js'
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#1851070/initial] (1) [perdir C:/web/apache/htdocs/test/] pass through C:/web/apache/htdocs/test/site/scripts/testValidate.js
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#1849050/initial] (3) [perdir C:/web/apache/htdocs/test/] strip per-dir prefix: C:/web/apache/htdocs/test/site/css/style.css -> site/css/style.css
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#1849050/initial] (3) [perdir C:/web/apache/htdocs/test/] applying pattern '^' to uri 'site/css/style.css'
127.0.0.1 - - [19/Jun/2014:09:34:52 +051800] [test.com/sid#7e48f0][rid#1849050/initial] (1) [perdir C:/web/apache/htdocs/test/] pass through C:/web/apache/htdocs/test/site/css/style.css
答案 0 :(得分:1)
由于重写循环是你的新正则表达式,你遇到了这个问题,即
^/?([a-z-]+)/?$
也匹配最后一个规则的目标URI,即
/display/
要防止此循环,请将第二条规则保留为:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?([a-z-]+)/?$ /display/?t=$1 [NC,L,QSA]
或者其他:
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^/?([a-z-]+)/?$ /display/?t=$1 [NC,L,QSA]
编辑:要从重写中跳过文件/目录,请使用此规则作为Rewrite Engine On
行下面的顶部:
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]