我有这样的情况:
如 /sport.html
所有URL隐藏真实的URL /archive.php?action=search§ion=sport
#这个是规则:
重写规则^([A-ZA-Z _] +([A-ZA-Z0-9 _] +)?)( - ([0-9] +)) HTML $ /archive.php?action=search&?。部分= $ 1 [L]
现在我想隐藏真实的URL和所有直接访问的页面 archive.php
,但我收到重定向循环错误此规则:
重写规则^档案的.php。* $ /404.html [F,NC,L]
解决方案
我想你实际上是在寻找的不是这样的:
重写规则^档案的.php。* $ /404.html [F,NC,L]
由于很明显,这将导致一个循环,因为你的第一条规则被改写为 archive.php
,并且该规则将其重写为别的,等等等等。
尝试,而不是上面的规则这样的:
的RewriteCond%{THE_REQUEST} /archive.php
重写规则^ /404.html [F,L]
或者,如果你想成为看中它:
的RewriteCond%{THE_REQUEST} /archive.php?action=search§ion =([^&放大器; ] +)
重写规则^ /%1.html [R,L]
I have this situation:
all urls like /sport.html
hide the real url /archive.php?action=search§ion=sport
#This is the RULE:
RewriteRule ^([a-zA-Z_]+([a-zA-Z0-9_]+)?)(-([0-9]+))?.html$ /archive.php?action=search§ion=$1 [L]
Now I want to hide the real url and all direct access to the page archive.php
but I receive the redirect loop error with this rule:
RewriteRule ^archive.php.*$ /404.html [F,NC,L]
解决方案
I think what you're actually looking for isn't this:
RewriteRule ^archive.php.*$ /404.html [F,NC,L]
As obviously, this causes a loop, since your first rule is rewriting to archive.php
, and this rule rewrites it to something else, etc. etc.
Try this instead of the above rule:
RewriteCond %{THE_REQUEST} /archive.php
RewriteRule ^ /404.html [F,L]
Or, if you want to be fancy about it:
RewriteCond %{THE_REQUEST} /archive.php?action=search§ion=([^& ]+)
RewriteRule ^ /%1.html [R,L]
相关推荐
最新文章