的.htaccess重写问题。可能是保留字? [英] .htaccess Rewrite issue. Possibly reserved words?
问题描述
这不需要太多的解释,很简单,如何做了以下工作:
重写规则^错误/浏览器/?$ /_errors/browser.php?error=browser [NC,QSA,L]
和这不起作用:
重写规则^错误/浏览器/?$ /_errors/browser.php?error=browser [NC,QSA,L]
在上述两个片段的唯一区别,是去除信的S
从单词的末尾错误
我不明白为什么这个词的另外的取值
错误
顿时使这个code工作。我能想到的唯一解释是,错误
是一个保留字?这样的话?
如果是这样的话那我怎么可以匹配并重写使用的.htaccess
文件字错误
?
更新
这是我的整个的.htaccess
文件:
#定义的默认文档
的DirectoryIndex index.php文件#打开重写引擎
RewriteEngine叙述在#的COM preSS所有的HTML,使用Javascript,CSS,XML文件...
AddOutputFilterByType DEFLATE text / plain的
AddOutputFilterByType DEFLATE text / html的
AddOutputFilterByType DEFLATE文本/ XML
AddOutputFilterByType DEFLATE文/ CSS
AddOutputFilterByType DEFLATE应用程序/ XML
AddOutputFilterByType DEFLATE是application / xhtml + XML
AddOutputFilterByType DEFLATE应用程序/ RSS + XML
AddOutputFilterByType DEFLATE应用程序/ JavaScript的
AddOutputFilterByType DEFLATE应用程序/ x-的javascript#设置错误页面重写
重写规则^错误/浏览器/?$ /_errors/browser.php?error=browser [NC,QSA,L]#设置一般先水平重写
重写规则^([A-Z - ] +)\\ / $ $ 1.PHP? [NC,QSA,L]
?重写规则^([A-Z - ] +)\\ /([A-Z-0-9] +)\\ / $ $ 1.PHP ID = $ 2放大器;放大器; [NC,QSA,L]
很奇怪的是,VIM将突出单词错误,但你可能只是试试这个破解它:
RewriteEngine叙述在
重写规则^埃罗[R] /index.html [NC,QSA,L]
在这里,也许是相关的一个问题:<一href=\"http://stackoverflow.com/questions/10872503/htaccess-and-the-word-find\">question-10872503
This does not require much explanation, quite simply, how does the following work:
RewriteRule ^errors/browser/?$ /_errors/browser.php?error=browser [NC,QSA,L]
and this does not work:
RewriteRule ^error/browser/?$ /_errors/browser.php?error=browser [NC,QSA,L]
The only difference in two above snippets, is the removal of the letter s
from the end of the word error
I cannot understand why the addition of an s
on the word error
suddenly makes this code work. The only explanation I can think of is that error
is a reserved word? Is this the case?
If this is the case then how can I match and rewrite the word error
using an .htaccess
file?
UPDATE
This is my whole .htaccess
file:
# Define the default document
DirectoryIndex index.php
# Turn on the rewrite engine
RewriteEngine On
# Compress all HTML, Javascript, CSS, XML... files
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Set the error page rewrites
RewriteRule ^errors/browser/?$ /_errors/browser.php?error=browser [NC,QSA,L]
# Set the general first level rewrites
RewriteRule ^([a-z-]+)\/?$ $1.php? [NC,QSA,L]
RewriteRule ^([a-z-]+)\/([a-z-0-9]+)\/?$ $1.php?id=$2& [NC,QSA,L]
Quite strange that vim will highlight the word "error", but you may simply try this to hack it:
RewriteEngine On
RewriteRule ^erro[r]/index.html [NC,QSA,L]
And here is an issue maybe related: question-10872503
这篇关于的.htaccess重写问题。可能是保留字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!