WordPress 301 redirect guide with .htacceess

0

Complete WordPress snippets guide with .htaccess file

WordPress 301 redirect guide with .htacceess file.

In the article I shall show you how to redirect a URL to another URL without losing visitors or SEO value. How to redirect one Web page or Content URL to another Web page or Content URL. How to redirect A Web page or Content URL from old URL to new URL . How to Redirect a web directory to another Web directory. How to Redirect one Domain to another Domain.

Worwpress-301-redirect-guide

Worwpress-301-redirect-guide

Some times we need to a URL to another URL for various reasons like SEO friendly Pramelink Optimization, Transfer domain to another domail, Change website program like HTML to PHP etc.

How to redirect ? : Add redirect code to below of your .htaccess file. To add it go to you website root directory and open the .htaccess file.

[sql]<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</ifmodule> [[ Add your code here.]] [/sql]

Redirect old Domain to New Domain

if you want to redirect a entire website to a existing Web page. Use the code in your old website .htaccess file of it’s root directory.

[html]RedirectMatch 301 / www.example.com/new-url/ [/html]

If you want to redirect a entire website to a new website. Use the code in old website .htaccess file of old website root directory.

Redirect 301 / www.example.com/

Redirect old URL to new URL without losing visitors or SEO value[Best way].

If you have changed a existing content or web page url, you will lose all previous visitors and SEO value. But if you redirect the old url to a new url, then your old url visitors and SEO value will redirect to new url. Add the code to your .htaccess file in your root directory. Replace /old-url/ with your old url without your domain now Replacewww.example.com/new-url/ with your new url with your  new domain or new link. Use the second process if your site url contains .html, .php etc extension. Save the .htaccess file.

redirect 301 /old-url/ www.example.com/new-url/

or

redirect 301 /old-url.html www.example.com/new-url.html

Redirect a Web page to Under a directory

if you want to transfer a existing page or content to under a directory. Use the redirect code in .htaccess file.

Redirect 301 /old-page-url.html www.example.com/new-directory.html

or

Redirect 301 /old-page-url/ www.example.com/new-directory/

Redirect a web page format to another format.

If you want to redirect your .html page to .php page. Use the code in .htaccess file.

RedirectMatch 301 /(.*).html  /(.*).php

Redirect a directory to another directory

If you want to redirect a entire directory to another directory. Use the code in .htaccess file.

RedirectMatch 301 /old-directory/ www.example.com/new-directory/

Share.

Leave A Reply