• Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / 301 & 302 Redirection in nginx, Htacess, wordpress etc Redirect URL & Domain SEO Friendly

301 & 302 Redirection in nginx, Htacess, wordpress etc Redirect URL & Domain SEO Friendly

 

 

Table of Contents

Toggle
  • Ways to redirect 301 in Nginx Server Block
  • 301 redirection in htaccess old domain to New domain
  • 301 redirection non SSL to SSL http to https
  • 301 redirect old url new URL
  • subdomain to main domain redirection 301
  • www to Non www redirection 301
  • Non www to www redirection 301
  • 301 Redirection Plugins in wordpress
  • 301 vs 302
  • 301 redirection spam google SEO by expired domain
  • redirect url to another url

Ways to redirect 301 in Nginx Server Block

location / {
return 301 http://jaggubhai.co.in/speed-post/;
}

 

301 redirection in htaccess old domain to New domain

 

301 redirection non SSL to SSL http to https

RewriteCond %{HTTP_HOST} !^example.com$
RewriteRule (.*) https://example.com/$1 [L,R=301]

301 redirect old url new URL

 

htaccess is apache server term,

so here full list of htaccess rewrite rules

subdomain to main domain redirection 301

RewriteCond %{HTTP_HOST} ^test.main.com
RewriteRule (.*) http://www.topsite.com/$1 [R=301,L]

 

www to Non www redirection 301

RewriteCond %{HTTP_HOST} ^yourwebsite.com
RewriteRule (.*) http://www.yourwebsite.com/$1 [R=301,L]

Non www to www redirection 301

RewriteCond %{HTTP_HOST} ^http://www.yourwebsite.com
RewriteRule (.*) yourwebsite.com/$1 [R=301,L]

301 Redirection Plugins in wordpress

Redirection plugin is best.

permalink finder is the worst thing, both google and user can;t understand the redirection, based on words matching. not the relevant page.

 

301 vs 302

  • 301, “Moved Permanently”—recommended for SEO old page authority goes to newone
  • 302, “Found” or “Moved Temporarily”

301 Permanently moved indicates to google bot & other search engines

302 temporarily moved in a certain time we will come back at

 

301 redirection spam google SEO by expired domain

buying an autort domain that;s expired redirecting new website. that’s not relevant sometimes relant

to make profits by affiliate commissions & PPC ads.

Not always treated as Spam. but user behaviour (high bounce rate, session duration etc) triggers google.

Skipping manual action on low quality sites etc.  WordPress duplicate thin content Issues {FIXED}

 

redirect url to another url

wordpress plugin: called redirection helps add source and target urls and status codes like 301 or 302.

html tag (blogger platform spam) <meta http-equiv=”refresh” content=”2;url=http://www.blogger to wordpress.com/” />

PHP <?php
header(“Location: http://www.mynewwebsite.com/blog/”);
?>

with status code to search engines

<?php
header(“HTTP/1.1 301 Moved Permanently”);
header(“Location: http://www.mynewwebsite.com/blog/”);
?>

htaccess

 

Redirect 301 /sourcepage.html http://www.targetdomain.com/

or

Redirect 301 / http://www.mynewdomain.com/

old url to new

Redirect 301 /sourcewppost.html http://www.anotherwebsite.com/newpage.html

redirect or rewrite (simple algorithms)

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy