Created
March 18, 2012 13:35
-
-
Save mortenjust/2072528 to your computer and use it in GitHub Desktop.
php 301 redirect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment