Access Standalone PHP File With Wordpress Installe

2019-09-06 13:17发布

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.

For example:

www.mywordpresssite.com/myscripts/myscript.php

This returns a 404.

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>

Is there any way I can achieve normal access to the said directory/file but without upsetting the current functionality of Wordpress?

Thanks a lot

标签: php wordpress
1条回答
Melony?
2楼-- · 2019-09-06 13:58

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>
查看更多
登录 后发表回答