Created
March 21, 2018 08:12
-
-
Save jerrickhakim/b0b3bd279e7c996a567a03ddd94fa07a to your computer and use it in GitHub Desktop.
.htaccess 301 Redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Redirect 301 /landingurl https://newurl.com/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code you can place in your .htaccess file for 301 redirects. Here is an example. I have a single author blog site, and I don't want users to be taken to the author archive page when they click on my name in a blog post. I'd rather have the visitor be redirected to my blog page. You can also use this to create custom post category post pages with your page builders if you don't want to mess with editing template files.
However, the most common use case for this is when you change your permalink to a page or post. Having a 301 redirect will prevent visitors from seeing your 404 page. Below is an image of the code in my .htaccess file.