I have about 25 301 redirects in my WordPress .htaccess file, that looks like this:

Redirect 301 /store/index.html https://www.example.com/store-home/

At the moment they are at the bottom of my .htaccess file, below the usual WordPress rewrite rules: # 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]
# END WordPress

So they are below all of that. Above my WP rewrite rules, I have a number of other rules from plugins (caching, SSL). Are my 301's OK where they are? Should they be somewhere else?


Since you are leveraging the .htaccess server file for redirecting, leave it above the BEGIN WORDPRESS rewrite rules. When users make a request for one of your redirected URLs the .htaccess will process its new URL redirect location before moving on to processing your WordPress rewrite rules. SO keep it above.

If you have a lot of redirect URL to keep up with, you might want to use a plugin like Redirection to manage redirections from your admin dashboard and that is the solution I personally opt for when I need to manage WordPress URL redirects.

  • 3
    "above the BEGIN WORDPRESS rewrite rules" - Actually, it makes no difference in this instance. Since the OP is using a mod_alias Redirect and WordPress uses mod_rewrite, it really makes no difference whether the OP's Redirect directives are above or below the WordPress front-controller. Different Apache modules work independently. mod_alias always runs after mod_rewrite on Apache, regardless of the order of directives in .htaccess. From a readability point of view you could argue that they should appear first, however, that is also a bit misleading, as they are actually executed last.
    – MrWhite
    Mar 26 '19 at 18:11

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.