访问安装了 Wordpress 的独立 PHP 文件 [英] Access Standalone PHP File With Wordpress Installed
本文介绍了访问安装了 Wordpress 的独立 PHP 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚在一个网站上安装了 wordpress.但是,我有一些独立的 php 文件用于分析站点上的数据库数据,这些文件现在在尝试访问它们时返回 404.
I have just installed wordpress on a site. However, I have some standalone php files that I use for analyzing database data on the site that now return a 404 when trying to access them.
例如:
www.mywordpresssite.com/myscripts/myscript.php
这将返回 404.
这是我的 .htaccess:
Here is my .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
有什么方法可以实现对上述目录/文件的正常访问,但又不会影响 Wordpress 的当前功能?
Is there any way I can achieve normal access to the said directory/file but without upsetting the current functionality of Wordpress?
非常感谢
推荐答案
把你的 .htaccess 文件改成这个
Change your .htaccess file to this
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/myscripts/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>
这篇关于访问安装了 Wordpress 的独立 PHP 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文