写.htaccess文件,而不%{} REQUEST_FILENAME [英] Write an .htaccess file without %{REQUEST_FILENAME}

查看:388
本文介绍了写.htaccess文件,而不%{} REQUEST_FILENAME的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个荒谬的问题,托管公司似乎无法照顾本身。我有一个Windows服务器具有ISAPI重写3运行,让我使用.htaccess文件进行文字preSS在网站上。但我注意到,

So I have a ridiculous problem that the hosting company cannot seem to take care of by itself. I have a website on a windows server that has ISAPI Rewrite 3 running to allow me to use .htaccess files for wordpress. But I noticed that the

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

语句不工作。他们将被忽略。这是一个配置的问题?在此同时我也有网站注册,并与我从什么地方

statements are not working. They are just ignored. Is this a configuration issue? In the mean time I have the site up and running with this clever line that I stole from somewhere

RewriteCond %{REQUEST_URI} (/[^.]*|\.(html?|php))$  [NC]

的问题是,使用这种线I不能访问所存在的实际目录。例/可湿性粉剂管理员/所以如果我要进行更改,在管理方面我必须使该行的限制由IP进行更改,然后关闭该行。完全荒谬的。

The problem is that using this line I cannot access an actual directory that exists. Ex. /wp-admin/ so if I want to make changes in the admin area I have to enable that line that restricts by IP make the changes and then turn off that line. Utterly ridiculous.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} (/[^.]*|\.(html?|php))$  [NC]
#disallow or allow just my IP address
#RewriteCond %{REMOTE_HOST} !1.2.3.4
RewriteRule .* /index.php [L]

任何解决方案,因此,我仍然可以访问存在的目录,而使用%{} REQUEST_FILENAME?

Any solutions so that I can still access directories that exist without using the %{REQUEST_FILENAME}?

推荐答案

嗯..我有赫利的ISAPI_Rewrite V3实际上在IIS 6上运行(与7 2年前收到了关于IIS)..和这些指令的工作细

Well .. I have Helicon ISAPI_Rewrite v3 running on IIS 6 (and had it on IIS 7 2 years ago) .. and these instructions actually work fine:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

这可能不是那样好,如果URL的一部分是虚拟的文件夹/应用..但它正常工作与真正的文件和文件夹。尝试这些替代(应该完全一样,如果没有虚拟的东西参与):

It may not work that well if part of the URL is virtual folder / application .. but it works fine with real files and folders. Try these instead (should work exactly the same if no virtual stuff involved):

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d

这篇关于写.htaccess文件,而不%{} REQUEST_FILENAME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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