May
4
htaccess Remove the www From Domain URL
May 4, 2008 |
Some web developers prefer to remove the “www” from their website domain URL. Although I am personally skeptical about this practice. There are supporter for this practice, the general reasons for removing “www”, to quote from www. is deprecated, the inspiration for this article:
“By default, all popular Web browsers assume the HTTP protocol. In doing so, the software prepends the “http://” onto the requested URL and automatically connect to the HTTP server on port 80. Why then do many servers require their websites to communicate through the www subdomain? Mail servers do not require you to send emails to recipient@mail.domain.com. Likewise, web servers should allow access to their pages though the main domain unless a particular subdomain is required. Succinctly, use of the www subdomain is redundant and time consuming to communicate. The internet, media, and society are all better off without it.”
To automatically remove the www from the beginning of your domain, add the following mod_rewrite rule to your .htaccess file. If you don’t have that file, create it in a text editor and upload it to your root directory. The code assumes your domain is called example.com, so you will need to change it to match your domain:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
Many web evangelist companies like Google and Yahoo still keep the www. To adopt this practice or not is totally up to you. If you have any better idea to use or not to use this, feel free to let me know!
Similar Posts
- htaccess Require the www For Domain URL
- Google Text Translation Using htaccess
- Block people from Certain URL Using htaccess
- Create Custom Error Pages Using htaccess PHP
- Use htaccess to Deny Access Directory Listing
- htaccess gzip for Faster Loading and Bandwidth Saving
- Use htaccess to Fake Different File Extension
- htaccess Permanently redirect file or directory
- Apache htaccess Prevent Users from Uploading and Executing Files
- Block IPs Using htaccess
- htaccess Explicitly Define Default Index File
- Set Local Timezone Using htaccess
- Use htaccess for 404 Redirect
- Remove File Extension Using htaccess
- Use htaccess to Deny Access to hidden Files
- Force Files Like PDF Download using htaccess
- Use htaccess with Site Maintenance Page
- htaccess Limit the Number of Concurrent Visitors to your Website
- htaccess Deny Diractory Access During a Specific Time
- Useful mod_rewrite Resources
- Deny Access to inc Files Using htaccess
- htaccess Conditional Loop Redirect
Comments
1 Comment so far



































very nice article, sounds very detailed.