简体   繁体   English

如何忽略.htaccess中用于重定向的特定文件

[英]How to ignore a specific file for redirection in .htaccess

My server provides the default redirection from www.test.com to test.com I want to remove the redirection for one specific file 'abc.php' there. 我的服务器提供了从www.test.com到test.com的默认重定向。我想在那里删除一个特定文件'abc.php'的重定向。 How to go about it? 怎么做呢?

The default redirection provided in the .htaccess file is: .htaccess文件中提供的默认重定向为:

<IfModule mod_rewrite.c>
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
</IfModule>

Like this (for abc.php): 像这样(对于abc.php):

<IfModule mod_rewrite.c>
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteCond %{REQUEST_URI} !^(.*/)?abc\.php$ [NC]
    RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
</IfModule>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM