Wordpress Custom Rewrites not Working

Avatar
  • Answered
I'm having trouble with Wordpress add_rewrite_rule(). However on my Rackspace server it all works fine. Some rewrite rules work and some don't however the specific rules I need for my site do not work. But the same pattern does work on the Rackspace server. I thought I would test in htaccess directly to see if there was an issue I could find and here's what I found: RewriteRule ^^redirect/? /index.php/contact-us [L] does not work on my InMotion server but does work on Rackspace. Identical Wordpress versions and I disabled all plugins. The following rule does work RewriteRule ^^redirect/? /index.php?p=26 [L] This next rule does not RewriteRule ^^redirect/? /index.php?pagename=contact-us [L] These are all valid URLs for Wordpress Full rewrite htaccess below # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteRule ^^redirect/? /index.php/contact-us [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress Can anyone offer any advice on how to resolve this issue? I contacted support through chat and they referred me here.
Avatar
johnpaulb-imhs1
Hello, Thank you for your question regarding custom .htaccess rewrite issues in WordPress. The "^^" doesn't seem right. Typically, we would expect something like "domain.com/^redirect/" Since WordPress also relies on .htacess rules, using a WordPress plugin for redirects can often help you avoid issues. Alternately, if you just want to 301 re-direct a page you can use the cPanel tool, which adds the rules to .htaccess for you. If your problems creating custom .htaccess rules persist, you may want to consider consulting a developer. Thank you, John-Paul