Skip to content

Instantly share code, notes, and snippets.

@mortenjust
Created March 18, 2012 13:35
Show Gist options
  • Save mortenjust/2072528 to your computer and use it in GitHub Desktop.
Save mortenjust/2072528 to your computer and use it in GitHub Desktop.
php 301 redirect
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