54378

Access Standalone PHP File With Wordpress Installed

Question:

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

Answer1:

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>

Recommend

  • How to shorten my title lenth by characters via php code wordpress
  • Read data from api and populate .csv bug
  • Amazon SES display sender name using PHP?
  • Error when trying to load Dual Listbox in Yii2
  • Twitter application oauth started returning error code 89 Invalid or expired token after 1 year work
  • cross subdomain login with cookies
  • redirect to another domain, but keep the url [duplicate]
  • How can I add a Submenu to the WordPress Admin Bar
  • How to get the current URL using wordpress (including index and category pages)
  • how to analyze min max loc returned by opencv's cvMatchTemplate?
  • Wordpress how to set the post excerpt length to 100 characters and 200 characters
  • Powershell 2: Easy way to direct every bit of output to a file?
  • Inline image affecting line-height
  • Get service name from the path of its executable
  • WooCommerce REST Client API - Programmatically get consumer key and secret
  • Twig_Error_Syntax for “Unknown filter” with a Twig filter in Timber
  • Creating Wordpress like shortcode in laravel blade
  • .NET library for posting to a Blog
  • Replace Add To Wishlist text with Heart icon WooCommerce
  • .htaccess HTTPS Main Domain & Wildcard HTTP Sub-Domains + All Non-WWW
  • Too many Redirects after switching WordPress to https
  • Wordpress Create Category AJAX Response
  • htaccess will not rewrite subdomains
  • PHP - Kill proc_open() process on different file?
  • When try to execute a cgi script, get the error: “[WinError 193] %1 is not a valid Win32 application
  • Wordpress and Drupal SSO/Single Sign On
  • wordpress query - next two events by metadata date
  • IIS 7.5 404 Error for .PDF files
  • Removing the .php file extension from the URL Request
  • Optimizing database types to compact database (SQLite)
  • Cross-Platform Protobuf Serialization
  • Do I've to free mysql result after storing it?
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Turn off referential integrity in Derby? is it possible?
  • Reading document lines to the user (python)
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal