1

Recently I changed my site URL, when anyone searches for my site in Google it shows old URL when they click on it shows 404 error. Is there any possibility to redirect old URL to new URL when they click on old one.

Mr. Alien
  • 153,751
  • 34
  • 298
  • 278

4 Answers4

0

Yes it is possible. Check the codes below.

<script>
window.location = "http://www.page-2.com";
</script>

just place it in your html.

For more details, visit How to redirect to another webpage in JavaScript/jQuery?

Community
  • 1
  • 1
Adrian Enriquez
  • 8,175
  • 7
  • 45
  • 64
0

You should make a new file on your old URL that returns a 301 (moved permantently). For example:

<?php 
    header("HTTP/1.1 301 Moved Permanently"); 
    header("Location: http://www.New-Website.com"); 
?>
Oscar Pérez
  • 4,377
  • 1
  • 17
  • 36
0

Or with php:

<?php
header("Location: http://yoururl");
?>
Alesfatalis
  • 769
  • 2
  • 13
  • 32
0

In old url ,you can use meta tag to route new url...

<META http-equiv="refresh" content="5;URL=http://www.example.com">
Mani
  • 888
  • 6
  • 19