如何限制目录的.htaccess? [英] How to restrict .htaccess for a directory?

查看:83
本文介绍了如何限制目录的.htaccess?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用.htacces文件,其中我将重定向

as

如果有人放入www.mysite.com /index.php

将重定向到www.mysite.com。

现在我有一个目录名支持。

所以网址是www .mysite.com / support / index.php。

我想要的只是没有重定向

www.mysite.com/support/index.php到www.mysite。 com / support。



如果你们中的任何人都知道解决方案,那么请告诉我。



谢谢


I am using .htacces file in which i put the redirection
as
if anyone put www.mysite.com/index.php
will redirect to www.mysite.com.
now i have a directory name support.
so the url is www.mysite.com/support/index.php.
what i want is simply not redirect
www.mysite.com/support/index.php to www.mysite.com/support.

If anyone of you know the solution then please let me know.

Thanks

推荐答案

典型的方法是将RewriteCond与规则结合使用。在下面的示例中,

RewriteRule被忽略,如果在此路径上存在文件(-f)或目录(-d)



Typical approach is to use RewriteCond in combination with rules. In example below,
RewriteRule is ignored, if on this path exists file (-f) or directory (-d)

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)


/index.php?/
/index.php?/


1 [L]





更多详情和示例出现在文档中



http: //httpd.apache.org/docs/2.0/mod/mod_rewrite.html [ ^ ]


这篇关于如何限制目录的.htaccess?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆