Various ways to redirect webpage URL.

There are various reasons to redirect a domain to another or a webpage URL to another.

Like if you are moving to a new domain with a new website with better design and you wish to keep your old website visitor then it will be better if you make a redirect to the new one.

If you wish to keep all of your website traffic to a single website then redirect all of your domain to main one. If you are having some 404 error page then you should redirect all your error page to another one for better visitor experience.

So, here are some ways to redirect URL –

1 – If looking to redirect your old domain to the new one then, if both of domain are on the same hosting provider and if your domain hosting provider having domain redirection services then you can do it from c panel.

2- In html , redirection can be done via meta tag –

<meta http-equiv=”refresh” content=”0; url=http://ecomspark.com/” />

3- Another option is to show a message with a link on it to you new website.

4- You can use javascipt also to redirect webpage url –

<scripttype=”text/javascript”>window.location.href=”http://example.com”</script>

5- In php, header function can be used to redirect a url –

<?php

header(“Location: example@example.com”, TRUE,303);

exit;

?>

6- If you using apache server then you can also redirect a webpage or domain via .htaccess file.

  • RewriteEngine On
    RewriteRule ^(.*)$ http://ecomspark.com/$1 [L,R=301]
  • “L” indicates that it’s the last instruction and “R” means redirect, and “301” means a permanent redirect.

How to use .htaccess for url redirect ?

8 Comments

Leave a Reply