Steps to Set WordPress to Ignore a File Path
There are situations when it is necessary to permit access to a file or directory but not always a subdomain. When you upload a file or folder to your public_html directory, for instance, WordPress tries to access the file location but returns a 404 error. In these situations, you may tell your WordPress website to disregard the file location by adding a rewrite condition to your.htaccess file. This will cause a file, such as domain.com/file.html, to be shown in its original format rather than being embedded into the main WordPress website.
Steps to Edit WordPress to Ignore a File Path
- Login to your account via SSH or cPanel File Editor, navigate to your WordPress directory.
- Open your website with .htaccess file.
- 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 WordPressAdd the below code above the RewriteCond lines, replacing file with the file path to your saved files:RewriteCond $1 !^(/file)
- Then save your changes.