某些页面具有出色的RewriteCond [英] Exceptional RewriteCond for some page
问题描述
假设我拥有这样的域 http://foo.com
该域作为当前使用 .htaccess
到 RewriteCond
和 .htaccess
代码是这样的:
Let say i have domain like this http://foo.com
this domain as present use .htaccess
to RewriteCond
and the .htaccess
code is like this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
此重写将发生在所有页面请求上,
现在我要更改此设置,以使其仅发生在除该页面之外的所有页面上:
This Rewrite will happen to all page request,
now i want to change this to make this only happen to all page except this page:
http://foo.com/en/rates.htm
我想做的页面 301重定向
像这样 Redirect 301 /en/rates.htm http://www.google.com/index.html
because in that page i want to do 301 redirect
like this Redirect 301 /en/rates.htm http://www.google.com/index.html
htaccess中如何做到这一点?
How to this in htaccess?
预先感谢您,
GusDe
Thank you in advance,
GusDe
推荐答案
您在问题中应该中指定的重定向
指令有效,您可以将其添加到.htaccess文件中,然后再重写内容块。
The Redirect
directive you specified in your question should work, you can add it to your .htaccess file, before the Rewrite stuff block.
如果仍然无法正常工作,则可能是Apache尚未加载mod_alias模块,然后您可以在.htaccess文件中的其他Rewrite之前添加此指令: / p>
If it doesn't work still, maybe Apache has not loaded the mod_alias module, and then you can add this directive before the other Rewrite's in the .htaccess file:
RewriteRule ^/en/rates\.htm http://www.google.com/index.html [R,L]
您可以查看此 Apache文档页面。
这篇关于某些页面具有出色的RewriteCond的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!