Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online
7 registered (SteveS, mcasado, Mike L, Gizmo, SD, Bjab, driv), 18 Guests and 14 Spiders online.
Key: Admin, Global Mod, Mod
Featured Member
Registered: 06/05/06
Posts: 255
Top Posters (30 Days)
Ruben 63
SD 54
Gizmo 48
gliderdad 33
Dunny 21
driv 18
dbremer 16
Iann128 16
Stan 14
Mark S 13
Latest Photos
Testing
Basildon Train Station
Basildon Town Centre looking from the rounderbout
Basildon Town Square
Gizzo Marx
Topic Options
#188515 - 06/24/07 03:14 AM How do I force all "non-WWW" url requests to my "www" domain?
Gizmo Online   cat

Registered: 06/05/06
Posts: 14904
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.
_________________________
Forums: UGN Security & VNC Web Design & Development
UBB.Threads: UBB.Wiki, My UBBSkins, UBB.Sitemaps
Longtime UBB Supporter, UBB Beta Tester & Resident Post-A-Holic.
UBB Modifications, Styling, Coding Services, Disaster Recovery, and more!
Top
Express Hosting
Express Hosting "We are the official hosting company of UBB.threads. Ask us about our free migration services to migrate your UBB.threads installation."
#194057 - 08/07/07 08:38 PM Re: How do I force all "non-WWW" url requests to my "www" domain? [Re: Gizmo]
Gizmo Online   cat

Registered: 06/05/06
Posts: 14904
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 WWW URLs to non-www
RewriteCond %{HTTP_HOST} ^www.corthell.net$
RewriteRule ^(.*) http://corthell.net/$1 [QSA,L,R=301]


Edited by Gizmo (08/03/11 02:35 AM)
_________________________
Forums: UGN Security & VNC Web Design & Development
UBB.Threads: UBB.Wiki, My UBBSkins, UBB.Sitemaps
Longtime UBB Supporter, UBB Beta Tester & Resident Post-A-Holic.
UBB Modifications, Styling, Coding Services, Disaster Recovery, and more!
Top



Shout Box

Today's Birthdays
No Birthdays
Recent Topics
Edit Post
by Bert
01:19 PM
A positive note
by SteveS
09:36 PM
How to locate links to particular site if they are only used in images?
by Conrad
02/10/12 09:41 PM
Pictures not displaying
by Marker23
02/09/12 10:04 PM
Issue with logging out constantly
by Flanuva
02/09/12 07:05 PM
Forum Stats
10213 Members
36 Forums
33667 Topics
180917 Posts

Max Online: 978 @ 06/24/07 11:19 PM
Random Image