The Gist:
If you find that the 301 redirects, you have added using cPanel’s “Redirects” tool, are not working on a WordPress site, make sure these redirects are added before the WordPress rewrite rules, in the .htaccess
.
Best way to ensure this is to add your redirect rules first, through cPanel, then edit the .htaccess
file and move the WordPress rewrite rule (everything between the comments # BEGIN WordPress
& # END WordPress
) below any redirect rules inserted via cPanel.
The Issue:
cPanel 301 redirects not working on a WordPress site
The Fix:
Move the WordPress rewrite rule below any 301 redirect rules added via cPanel.
Example:
# cPanel Redirect Rule
RewriteCond %{HTTP_HOST} ^yoursite\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.yoursite\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "https\:\/\/theothersite\.com\/" [R=301,L]
# BEGIN WordPress
RewriteEngine OnRewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]# END WordPress