写一个.htaccess重写规则不包括一个文件 [英] Write an .htaccess rewrite rule excluding one file
问题描述
我的工作提供了一个框架,需要拨打电话到一个目录中的特定文件,但该目录设置为所有URL请求到index.php为框架的缘故。
I'm working with a framework and need to make a call to a specific file within a directory, however the directory is set up for url of all requests to index.php for the framework's sake.
我有一个名为入住session.php文件
,需要的任何请求本地主机/管理/签session.php文件
执行实际检查session.php文件文件,而不是路由的index.php
。我该怎么做,与同一文件夹内的.htaccess文件入住session.php文件
?
I have a file called check-session.php
and need any requests to localhost/admin/check-session.php
to execute the actual check-session.php file instead of route to index.php
. How do I do that with .htaccess file within the same folder as check-session.php
?
我没有什么可以与重写规则/条件没有经验。
I have little to no experience with rewrite rules / conditions.
推荐答案
查找重写到index.php文件的重写规则和之前它把这些直接:
Find the RewriteRule that rewrites to index.php and put these directly before it:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !\.php$
这应该阻止它映射到index.php,如果是你要求一个真实的文件。
That should stop it mapping to index.php if it's a real file you request.
如果不工作,张贴实际重写在.htaccess
If that doesn't work, post the actual rewrites in .htaccess
这篇关于写一个.htaccess重写规则不包括一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!