Posted By

traeregan on 10/07/09



Viewed 379 times
Favorited by 0 user(s)

Force WWW Subdomain

/ Published in: PHP
Save to your folder(s)

Sometimes you do not want users to access your domain without the www. If you want to force and redirect to here is a simple way to do it.

Copy this code and paste it in your HTML
  1. if ((strpos($_SERVER['HTTP_HOST'],'www.')===false)) { header('Location:'); exit(); }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.