Redirecting a website to another location is an easy process that can be done with the quick use of the Internet browser. At times, the website that you are looking at might be under construction and you might need to redirect it to another website.

This is where the scrolling option on the top bar comes into play. This article will help you understand how to redirect a website to another location so you can get back to your search.


Here I will show few ways to Redirect A Page Website. hope the information might be helping with your work. So let’s check the method

Redirect using HTML Code

Meta tag http-equiv refresh is used to tell the browser to refresh or reload the page and is usually placed in the section of an HTML document.

<meta http-equiv="refresh" content="5"/>

The option content defines the time in seconds of how long should the browser wait to reload the page.

To redirect to another site, the option content need to slightly be changed to include the URL it is to be redirected to and as in the following example, will immediately redirect to

<meta http-equiv="refresh" content="0;url="/>

Redirect using JavaScript Code

JavaScript redirection is another process if you are familiar with JavaScript.First, decide Control over what page is loaded into the browser rests in the JavaScript property window.location.

By setting window.location equal to a new URL, you will turn, change the current web page to the one that is specified.

If you wanted to redirect all your visitors to when they arrived at your site.

Then you can use JavaScript, you can set the location.href of the window:

<script type="text/javascript">
    window.location.href = "";

Redirect using .htaccess

.htaccess is very powerful.Since .htaccess is a hidden system file. Even any syntax error page easily redirects to another place.

Here I will show some option for the redirection page. just take a look


Step 1: Create an empty text file using a text editor such as notepad, and save it as htaccess.txt.

Copy & the past the code insert the file.

RewriteEngine on
# remove trailing slash
RewriteRule (.+)/$ /~account/$1 [L,R=301]

# add trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .*[^/]$ /~account/$1/ [L,R=301]

# perform redirect if
RewriteCond %{HTTP_HOST} ^$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

Replace the 3 occurrences of ~account with the name of the actual account.

Step 2: Now Upload them htaccess.txt via FTP client application on your server. Once uploaded to the server you can rename the file to .htaccess. just it.

Redirect www to non www version of site

Options +FollowSymLinks 
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^
RewriteRule (.*)$1 [R=301,L]

Redirect non-www to www

Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^ [NC] 
RewriteRule ^(.*)$$1 [L,R=301]

Redirect to

Options +FollowSymLinks
RewriteEngine on
# index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /.*index.php HTTP/
RewriteRule ^(.*)index.php$ /$1 [R=301,L]

Note: The definitive guide on Apache directives that can be used in .htaccess files can be found here:

Redirect using PHP Code

if your pages are PHP enabled, simply place this code at the very top of the old file and your visitors will be smoothly sent to the new location.

Header("HTTP/1.1 301 Moved Permanently");

Redirect using PHP Code For Mobile Version

If you have 2 versions of your website 1 for web version 2 for only for mobile enable.then here a solution using the same domain you can send your visitor for different platform.

like the user using a smartphone to visit your site than user going to your mobile enable site where you can send your user.

Beside when web user types than user going to your web version of your website.

Step 1: Create an empty .php file using a text editor such as notepad, and save it as index.php.Copy & the past the code insert the file. place the index.php in your root folder.

function detect_mobile_device(){

// check if the user agent value claims to be windows but not windows mobile
if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){
return false;
// check if the user agent gives away any tell tale signs it's a mobile browser
if(eregi('up.browser||windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp',$_SERVER['HTTP_USER_AGENT'])){
return true;
// check the http accept header to see if wap.wml or wap.xhtml support is claimed
return true;
// check if there are any tell tales signs it's a mobile device from the _server headers
return true;
// build an array with the first four characters from the most common mobile user agents
$a = array(
// check if the first four characters of the current user agent are set as a key in the array
return true;

function detect_iphone(){
return true;
// example 1 - detect and redirect mobile browsers

// example 2 - detect and redirect desktop browsers

// example 3 - send iphone to specific site


We hope you enjoyed our article on how to move a website from one location to another. We know it can be a task to replace a website’s hosting and moving the website to another location.

This is a great place to start for any website owners who are looking for a company to help them out. If you haven’t started looking for companies to take over your website hosting, now might be a good time to do so.

It’s always difficult to find help for this type of work when you need it, so please rest assured that we are here for you. Please don’t hesitate to reach out to us at. Thank you for reading, we would love to hear from you!

Affiliate Disclaimer : As an Amazon Associate I earn from qualifying purchases.