To force a specific domain to be used when your site can be accessed by several, a tidy way is to use mod_rewrite. This lends itself very well to password protected directories that have images referenced by a specific domain and you don’t want multiple password prompts.
RewriteEngine On RewriteCond %{HTTP_HOST} !^example.com [NC] RewriteRule ^.*$ http://example.com%{REQUEST_URI} [R,L]

Categories: LAMP

Jonathan Adjei

Jon's expertise in web development is legendary and he oversees all technical aspects of our projects from development to hosting (all through the command line!) Jon is excited by the latest techniques and keeps the company on track by finding ways to adopt new practices into our workflow.