There are occasions when it is crucial to grant access to a file or directory without a subdomain.
For instance, when you upload a file or folder to your public HTML directory, WordPress cannot reach the file location and displays a 404 error.
In these circumstances, you may cause your WordPress website to disregard the file path of that file by adding a rewrite condition to your .htaccess file.
With this, a file, such as domain.com/file.html, will be shown directly on the browser rather than being incorporated within the parent WordPress website.
How to Make WordPress Disregard a File Path
- Navigate to your WordPress directory after logging into your account using SSH or the cPanel File Editor.
- Use the .htaccess file to access your website.
- Look at the sample WordPress .htaccess file below:
Replace the file with the file path to your saved files and add the following code above the RewriteCond lines:
RewriteCond $1 !^(/file)
4. Save your changes after that.