InfoHeap
Tech tutorials, tips, tools and more
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Wordpress beginner tutorials

  • Getting started with wordpress and some useful plugins
  • How to add tag and category to wordpress pages
  • How to become Google verified author of your wordpress blog using Google+ profile
  • How to handle permanent redirects in wordpress
  • How to write custom css in wordpress
  • Using ssh sftp updater support for updating wordpress plugins and themes
  • Wordpress - how to display code from a file in textarea
  • Wordpress - how to make a post sticky on home page
  • Wordpress themes for beginners worth considering
 
  • Home
  • > Tutorials
  • > Wordpress
  • > Wordpress beginner

How to handle permanent redirects in wordpress

By admin | Last updated on Mar 15, 2016

There are multiple options available to handle redirects in wordpress. A redirect is a way to tell the users and search engines that a page have moved to a new location. The move can be temporary or permanent. For permanent move “HTTP 301” header is used by web servers. Here is a example using HTTP live headers Firefox plugin:

http-live-header-301-redirect

In this example a url https://infoheap.com/category/hosting/ is being redirected to https://infoheap.com/tag/hosting/. This is the response which tells browsers or search engine crawlers/bots that the page have moved permanently:

HTTP/1.1 301 Moved Permanently
Location: https://infoheap.com/tag/hosting/

There are multiple ways to handle permanent redirects in wordpress:

  1. When a post or page is renamed, wordpress automatically generate the redirect header as it stores old urls in revisions. So you dont have to do anything. But if you clean the old revisions data regularly (I use wp-optimize to clear old revisions regularly) for performance reasons, this may not work.
  2. Using some redirection plugin. I have tried Redirection plugin and this seems to be one of the best plugin for handling redirection. You specify source and destination url and it takes care of redirection for you. It also generates reports on how many redirects happened, etc. In addition it provides 404 reports also for “page not found” errors.
    wordpress-redirection-plugin-descriptionwordpress-redirection-plugin-settingsI would strongly recommend this plug to handle redirects.
  3. One more option is to use apache RedirectRule in apache configuration as show.
    RewriteEngine On
    RewriteRule ^/category/technology/hosting/   https://infoheap.com/tag/hosting/   [L,R=301]

    This uses apache mod_rewrite extension. Now why would you use apache configuration option when more user friendly options are available? Using apache is usually faster as it happens much before php scripts are loaded and there is no database query and update. So in cases where there are many hits on some specific urls, you may want to consider this option.

Suggested posts:

  1. How to redirect wordpress feed to feedburner feed url
  2. Meta robot noindex, follow for wordpress tags and category pages
  3. How to add tag and category to wordpress pages
  4. How to change twitter handle and its impact on traffic
  5. WordPress – how to display code from a file in textarea
  6. Using ssh sftp updater support for updating wordpress plugins and themes
  7. How to hide a post from home and RSS feed in wordpress
  8. how to use netcat (nc) to test HTTP url redirection
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Apache, mod_rewrite, Tutorials, Wordpress, Wordpress beginner

Follow InfoHeap

facebook
twitter
googleplus
  • Browse site
  • Article Topics
  • Article archives
  • Recent Articles
  • Contact Us
  • Omoney
Popular Topics: AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries

Copyright © 2021 InfoHeap.

Powered by WordPress