Jump to content

PHPLD Default URL Issue


davis

Recommended Posts

The browser is reponsible for passing the hostname.  So long as your site supports resolution of mydomain.com, you get a webpage there, which is undoubtedly what you want. 

 

To redirect all requests for mydomain.com to www.mydomain.com you can forward them, using one of a number of techniques.  With apache people frequently use mod_rewrite rules.  As this is usuallly an SEO optimization seeking to insure that engines don't split results for the same thing due to subdomain confusion, the way to handle this is to have your webserver issue a 301 response, which tells the client that the url they are requesting has moved permanently.  This will cause search engines to make sure that they aggregate/combine all their indexing to the desired domain.  Here's a typical mod_rewrite ruleset:

 

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com$1 [R=301,L]

 

Your framework could implement this type of thing itself, but it's faster and more efficient in most cases to use mod_rewrite.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.