Steps to Set WordPress to Ignore a File Path
Sometimes, it’s necessary to permit access to a file or directory however don’t need a sub domain. For instance, once you upload a file or folder to your public_html directory, however WordPress shows a 404 error whereas trying to access its file path. In such cases, you can create a rewrite condition within your .htaccess file to force your WordPress web site to ignore the file path of that file. With this a file – e.g. domain.com/file.html – can get displayed as is rather than embedded as a part of the parent WordPress web site.
Let’s see the 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 web site 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
You need to add the below given code above the RewriteCond lines, replacing file with the file path to your saved files:
RewriteCond $1 !^(/file)
4. Then save your changes.