/ Published in: PHP
Removes WWW from the current URL, if exists.
Expand |
Embed | Plain Text
Comments
Subscribe to comments
You need to login to post a comment.
thewickedchemist on 12/16/11
1 person have marked this snippet as a favorite
Removes WWW from the current URL, if exists.
Subscribe to comments
You need to login to post a comment.
if ( 0 === stripos( $_SERVER['HTTP_HOST'], 'www.' ) ) { header( 'HTTP/1.1 301 Moved Permanently' ); header( 'Location: http://' . substr( $_SERVER['HTTP_HOST'], 0, 4 ) . $_SERVER['REQUEST_URI'] ); exit; }