How to create redirects in htaccess

You should ALWAYS put redirects in htaccess. WHY?

  • Because redirects are process much quicker from the server-level when using htaccess, instead of from the software-level via WordPress plugin (PHP).
  • So do what I said: put all your redirects into htaccess, and then get rid of all your redirection plugins.

HOW do you put redirects into htaccess?

  • The “.htaccess” file is located in your cPanel > File Manager…in the “public_html” directory or your domain name directory (for addon domains & subdomains). You can edit it directly from File Manager or download/edit from your local computer using FTP. (Make sure you click “Settings” and show hidden files if you’re using File Manager in cPanel.)
  • Where do you put these redirects in htaccess? You can put them at the very end after everything else. We recommend putting them somewhere after the line that says: # END WordPress

Simple redirects:

Copy paste the example line written below into your htaccess. You should put it somewhere after the WordPress section.

Redirect 301 /oldpage https://domain.com/newpage

  • This redirects “https://domain.com/oldpage” to “https://domain.com/newpage”

Exporting redirects from Redirection plugin:

  • Using the “Redirection” plugin? Most WordPress redirect plugins have a simple export to apache/htaccess function that generates the rewrite configuration for you. Simply copy these and paste into your htaccess file somewhere after the line that says: # END WordPress

Looking for ultra-fast WordPress hosting?

Learn More About JVPS

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *