Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
Who's Online
3 registered (driv, FordDoctor, Ruben Rocha), 28 Guests and 21 Spiders online.
Key: Admin, Global Mod, Mod
Featured Member
Registered: 11/21/08
Posts: 1
Top Posters (30 Days)
Ruben Rocha 180
Gizmo 112
Rick 106
Thelockman 79
driv 43
AllenAyres 35
ntdoc 28
Ian 24
Sirdude 23
ScriptKeeper 20
Latest Photos
My Home System
test photo gallery
Bernese Mountain Dogs
My Daimler
Dorado and shark
Topic Options
Rate This Topic
#188515 - 06/24/07 12:14 AM How do I force all "non-WWW" url requests to my "www" domain?
Gizmo Moderator Offline

***

Registered: 06/04/06
Posts: 12007
Loc: Portland, OR; USA
This is quite simple to do in Apache with your .htaccess file (if you don't have a .htaccess file in your web root, you can add one).

The following is what I use on my site to accomplish this:
 Code:
# Allow Re-Writing
RewriteEngine on

# Redirect non-www URLs to WWW
RewriteCond %{HTTP_HOST} ^corthell.net$
RewriteRule ^(.*) http://www.corthell.net/$1 [QSA,L,R=301]


Simply replace "corthell.net" with your domain on the two lines that it's mentioned, insert into your .htaccess file, and upload to your server.
_________________________
UGN Security, Elite Web Gamers & VNC Web Design Owner
Longtime UBB Supporter, UBB7 Beta Tester & Resident Post-A-Holic

Top
#194057 - 08/07/07 05:38 PM Re: How do I force all "non-WWW" url requests to my "www" domain? [Re: Gizmo]
Gizmo Moderator Offline

***

Registered: 06/04/06
Posts: 12007
Loc: Portland, OR; USA
Due to the non-www stance some users use, I'm also going to describe how to send all www requests to the non-www domain... Be sure that you're not using both of these as you could cause a lot of looping on your webserver.

The instructions above are still valid, however, use this .htaccess block.

 Code:
# Allow Re-Writing
RewriteEngine on

# Redirect non-www URLs to WWW
RewriteCond %{HTTP_HOST} ^www.corthell.net$
RewriteRule ^(.*) http://corthell.net/$1 [QSA,L,R=301]
_________________________
UGN Security, Elite Web Gamers & VNC Web Design Owner
Longtime UBB Supporter, UBB7 Beta Tester & Resident Post-A-Holic

Top


Moderator:  Gizmo 
Shout Box

Today's Birthdays
No Birthdays
Recent Topics
I'm the Admin but.....
by David DelMonte
Today at 11:12 AM
Fatal error: Smarty::require_once
()

by ThreadsUser
Today at 08:17 AM
PayPal batch file for ID'ing expired and failed payment subscriptions?
by Mitch P.
Today at 06:02 AM
Shrinking graemlins
by Djuma
Yesterday at 05:48 PM
2 problems I'm seeing now.
by DougMM
Yesterday at 04:39 PM
Forum Stats
4261 Members
33 Forums
30535 Topics
154977 Posts

Max Online: 978 @ 06/24/07 08:19 PM