Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  WordPress FAQ  >  Steps to Set WordPress to Ignore a File Path
Top Scroll

Steps to Set WordPress to Ignore a File Path

 2 min

Sometimes, it is important to allow access to a file or directory but don’t require a sub domain. For example, when you upload a file or folder to your public_html directory, but WordPress shows a 404 error while attempting to access its file path. In such cases, you can create a rewrite condition within your .htaccess file to force your WordPress website to ignore the file path of that file. With this a file – e.g. domain.com/file.html – will get displayed as is instead of embedded as part of the parent WordPress website.

Steps to Edit WordPress to Ignore a File Path

  1. Login to your account via SSH or cPanel File Editor, navigate to your WordPress directory.
  2. Open your website with .htaccess file.
  3. Check below the default WordPress .htaccess file:
    # BEGIN WordPress
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    # END WordPress

    Add the below code above the RewriteCond lines, replacing file with the file path to your saved files:

    RewriteCond $1 !^(/file)
  4. Then save your changes.
For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.