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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 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 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress |