写入不带 %{REQUEST_FILENAME} 的 .htaccess 文件
所以我有一个荒谬的问题,托管公司似乎无法自行解决。我在 Windows 服务器上有一个网站,运行 ISAPI Rewrite 3,允许我使用 WordPress 的 .htaccess 文件。但我注意到这些
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
声明不起作用。他们只是被忽视了。这是配置问题吗?与此同时,我使用从某处偷来的这条巧妙的线路启动并运行了该站点。
RewriteCond %{REQUEST_URI} (/[^.]*|\.(html?|php))$ [NC]
问题是使用这条线路我无法访问存在的实际目录。前任。 /wp-admin/ 因此,如果我想在管理区域中进行更改,我必须启用受 IP 限制的线路进行更改,然后关闭该线路。太荒谬了。
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} 的情况下仍然可以访问存在的目录吗?
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]
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]
Any solutions so that I can still access directories that exist without using the %{REQUEST_FILENAME}?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯..我在 IIS 6 上运行 Helicon ISAPI_Rewrite v3(两年前在 IIS 7 上运行过它)..这些说明实际上工作正常:
如果 URL 的一部分,它可能无法正常工作是虚拟文件夹/应用程序..但它可以很好地处理真实的文件和文件夹。尝试这些(如果不涉及虚拟内容,应该工作完全相同):
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:
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):