Thursday, October 27, 2016
How To Redirect A Page Website To Another Location
How To Redirect A Page Website To Another Location
Today in this article I will show how to Redirect A Page Website to another new page or new website .There are many methods are available for doing this simply work . its depends on your working environment.

Here I will show few ways to Redirect A Page Website. hope the information might be helping for your work.
So lets 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.
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 http://www.thedevline.com
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
then you can use JavaScript, you can set the
Redirect using .htaccess
.htaccess is very powerful.Since
Here I will show some option for redirection page. just take a look
Step 2 : Now Upload the
Note: The definitive guide on Apache directives that can be used in .htaccess files can be found here:http://httpd.apache.org/docs/current/mod/core.html
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.
If you have 2 version 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 example.com than user going to your mobile enable site where you can send your user . Beside when web user type example.com than user going to your web version of your website.
Step 1 : Create an empty
This is not a complete list by any means, but it took me ages to find how to do these so Ill save you the hassle and list them here.if you face any problem by doing this work then dont forget to write a comment here.

Here I will show few ways to Redirect A Page Website. hope the information might be helping for your work.
So lets 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 second 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 http://www.thedevline.com
<meta http-equiv="refresh" content="0;url=http://www.thedevline.com"/> 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 www.yourdnewomain.com 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 = "http://www.yourdomain.com/somepage.html";
</script>
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 redirection page. just take a look
Instructions
Step 1 : Create an empty text file using a text editor such as notepad, and save it ashtaccess.txt.Copy & the past the code insert the file . RewriteEngine onReplace the 3 occurrences of
# 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 thedevline.com
RewriteCond %{HTTP_HOST} ^www.thedevline.com$ [NC]
RewriteRule ^(.*)$ http://www.google.com/~account/$1 [R=301,L]
~account with the name of the actual account. Step 2 : Now Upload the
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} !^example.com
RewriteRule (.*) http://example.com/$1 [R=301,L]
Redirect non-www to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
Redirect example.com/index.php to example.com
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:http://httpd.apache.org/docs/current/mod/core.html
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.
<?php
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: http://www.example.com/");
?> Redirect using PHP Code For Mobile Version If you have 2 version 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 example.com than user going to your mobile enable site where you can send your user . Beside when web user type example.com 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. <?php
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 its a mobile browser
if(eregi(up.browser|up.link|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
if(stristr($_SERVER[HTTP_ACCEPT],text/vnd.wap.wml)||stristr($_SERVER[HTTP_ACCEPT],application/vnd.wap.xhtml+xml)){
return true;
}
// check if there are any tell tales signs its a mobile device from the _server headers
if(isset($_SERVER[HTTP_X_WAP_PROFILE])||isset($_SERVER[HTTP_PROFILE])||isset($_SERVER[X-OperaMini-Features])||isset($_SERVER[UA-pixels])){
return true;
}
// build an array with the first four characters from the most common mobile user agents
$a = array(
acs-=>acs-,
alav=>alav,
alca=>alca,
amoi=>amoi,
audi=>audi,
aste=>aste,
avan=>avan,
benq=>benq,
bird=>bird,
blac=>blac,
blaz=>blaz,
brew=>brew,
cell=>cell,
cldc=>cldc,
cmd-=>cmd-,
dang=>dang,
doco=>doco,
eric=>eric,
hipt=>hipt,
inno=>inno,
ipaq=>ipaq,
java=>java,
jigs=>jigs,
kddi=>kddi,
keji=>keji,
leno=>leno,
lg-c=>lg-c,
lg-d=>lg-d,
lg-g=>lg-g,
lge-=>lge-,
maui=>maui,
maxo=>maxo,
midp=>midp,
mits=>mits,
mmef=>mmef,
mobi=>mobi,
mot-=>mot-,
moto=>moto,
mwbp=>mwbp,
nec-=>nec-,
newt=>newt,
noki=>noki,
opwv=>opwv,
palm=>palm,
pana=>pana,
pant=>pant,
pdxg=>pdxg,
phil=>phil,
play=>play,
pluc=>pluc,
port=>port,
prox=>prox,
qtek=>qtek,
qwap=>qwap,
sage=>sage,
sams=>sams,
sany=>sany,
sch-=>sch-,
sec-=>sec-,
send=>send,
seri=>seri,
sgh-=>sgh-,
shar=>shar,
sie-=>sie-,
siem=>siem,
smal=>smal,
smar=>smar,
sony=>sony,
sph-=>sph-,
symb=>symb,
t-mo=>t-mo,
teli=>teli,
tim-=>tim-,
tosh=>tosh,
treo=>treo,
tsm-=>tsm-,
upg1=>upg1,
upsi=>upsi,
vk-v=>vk-v,
voda=>voda,
wap-=>wap-,
wapa=>wapa,
wapi=>wapi,
wapp=>wapp,
wapr=>wapr,
webc=>webc,
winw=>winw,
winw=>winw,
xda-=>xda-
);
// check if the first four characters of the current user agent are set as a key in the array
if(isset($a[substr($_SERVER[HTTP_USER_AGENT],0,4)])){
return true;
}
}
function detect_iphone(){
return true;
}
// example 1 - detect and redirect mobile browsers
if(detect_mobile_device()){
header(Location: http://mobile.thedevline.com);
exit;
}
// example 2 - detect and redirect desktop browsers
if(!detect_mobile_device()){
header(Location: http://www.thedevline.com/);
exit;
}
// example 3 - send iphone to specific site
if(detect_iphone()){
header(Location: http://iphone.thedevline.com/);
exit;
}
?> Conclusion This is not a complete list by any means, but it took me ages to find how to do these so Ill save you the hassle and list them here.if you face any problem by doing this work then dont forget to write a comment here.
Get link for download