1

I use the redirection plugin which can give me the rewrite rules in this format as output:

# Created by Redirection
# Sun, 06 May 2018 09:25:01 +0000
# Redirection 3.2 - https://redirection.me

<IfModule mod_rewrite.c>
RewriteRule ^abc$ /123/ [R=301,L]
</IfModule>

# End of Redirection

My current .htaccess file is standard:

enter image description here

Where should I add the direction code from the plugin into the .htaccess file? Should I add it first or last, or somewhere in the existing rule-set?

Thanks!

  • @ShameemAliP.K After the closing </IfModule> tag? That's exactly where you shouldn't put these directives!? – MrWhite May 6 '18 at 11:05
0

Your external redirect needs to go at the very top of your .htaccess file, before the WordPress front-controller (ie. before the # BEGIN WordPress section).

If you place it at the end of the file then it will simply never get processed, because the WordPress front-controller routes all URLs and then stops further processing.

If you place it inside the # BEGIN WordPress block then WordPress is likely to (try to) overwrite this in a future update.

Aside: You don't need the <IfModule mod_rewrite.c> wrapper. You already know that mod_rewrite is enabled on your server (or not) and presumably this redirect is mandatory?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.