如何排除在htaccess的一个特定的文件 [英] How to exclude a specific file in htaccess
本文介绍了如何排除在htaccess的一个特定的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经写了下面code htaccess的
I have written below code in htaccess
重写规则^([A-ZA-Z _-] +)。PHP $ HTTP :?//www.domain.com/myfile.php页= INC- $ 1.PHP [NC]
RewriteRule ^([a-zA-Z_-]+).php$ http://www.domain.com/myfile.php?page=inc-$1.php [NC]
我不希望重写index.php文件 - 它应该正常打开
I don't want the index.php file to be rewritten - it should open normally.
推荐答案
您可以使用下面的code,排除所有现有文件(如的index.php):
You could use the following code, to exclude all existing files (like index.php):
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z_-]+).php$ http://www.domain.com/myfile.php?page=inc-$1.php [NC]
或排除仅的index.php
您可以使用:
RewriteCond %{REQUEST_URI} !^(.*/)?index\.php$ [NC]
RewriteRule ^([a-zA-Z_-]+).php$ http://www.domain.com/myfile.php?page=inc-$1.php [NC]
这篇关于如何排除在htaccess的一个特定的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文