Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Exclude a Folder From WordPress Permalinks

This guide shows you how to make a real folder on your site open normally, instead of showing a WordPress "404 Not Found" page.

WordPress2 min read12 steps

What is the problem?

A permalink is the web address of a page, such as yourdomain.com/about. WordPress uses a file named .htaccess to handle these addresses. A folder on your hosting account might hold something that is not WordPress, such as an old app or a test page. WordPress can take over its address and show a 404 error. You can tell WordPress to leave that folder alone.

The .htaccess file is a small settings file on the Apache web server. Its name starts with a dot, so it is hidden by default.

Warning: A mistake in .htaccess can cause a 500 error on your whole site. Download a copy of the file first as a backup.

Steps

  1. Log in to your hosting control panel. Your welcome email has the details.
  2. Open File Manager.
  3. Open the folder where WordPress is installed, often public_html.
  4. Click Settings at the top right and tick Show Hidden Files.
  5. Right-click .htaccess and choose Download to keep a copy.
  6. Right-click it again and choose Edit.
  7. Find the block that starts with # BEGIN WordPress.
  8. Add the new line just under RewriteBase /.
  9. Save the file.

Here is how the block looks with the extra line. Change myfolder to your folder name.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^myfolder/ - [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

The new rule says: if the address starts with myfolder/, stop here and do not send it to WordPress. The [L] means "last rule".

Check the result

  1. Open yourdomain.com/myfolder/ in your browser.
  2. Your folder content should show.
  3. Check that your normal WordPress pages still work.
Tip: WordPress can rewrite its block when you save Settings, then Permalinks. To keep your rule safe, put it above the # BEGIN WordPress line, inside its own <IfModule mod_rewrite.c> section.

Quick recap

  • WordPress can hide real folders behind a 404 page.
  • Add a RewriteRule to .htaccess for that folder.
  • Always keep a copy of the file before you edit.
  • Test the folder and your normal pages afterwards.