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!

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

1 Answer 1

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 and acknowledge you have read our privacy policy.

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