Mondoze Knowledge Base

Search our articles or browse by category below

How to redirect complete WordPress subfolder from .htaccess file

Last modified: October 8, 2022
You are here:
Estimated reading time: < 1 min

How to redirect complete WordPress subfolder from .htaccess file

Before edit the .htaccess file, you need to copy a backup .htaccess to your local PC.

Existing .htaccess should look something like:

Code:

==================================================

# BEGIN WordPress

 

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

 

# END WordPress

==================================================

Add a redirect for complete folder:

Code:

==================================================

# BEGIN WordPress

 

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

 

# END WordPress

Redirect 301 /oldfolder http://www.yourdomain.com/newfolder

==================================================

Was this article helpful?
Dislike 0
Views: 59