Results 1 to 1 of 1
Hybrid View
-
19th Sep 2015, 05:44 PM #1
SEO - 301 Cononical Redirect - Adds WWW
Issues a check to see if the "www" is included, if not, forces "www" to be appended to the URL in question.
PHP Code:<?php
if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
}
?>Kevin Reviewed by Kevin on . SEO - 301 Cononical Redirect - Adds WWW Issues a check to see if the "www" is included, if not, forces "www" to be appended to the URL in question. <?php if (substr($_SERVER,0,3) != 'www') { header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.'.$_SERVER.$_SERVER); } ?> Rating: 5
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Vn5socks.net 21-08-2024 | socks 5...
Live | 212.83.137.150:52930 | United Kingdom |...