Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online Now
2 registered members (M4TT, mmkk), 141 guests, and 372 spiders.
Key: Admin, Global Mod, Mod
Member Spotlight
whk
whk
Portsmouth, RI
Posts: 86
Joined: January 2009
Show All Member Profiles 
Top Posters(30 Days)
Gizmo 14
FREAK 11
M4TT 9
mmkk 5
isaac 4
Ruben 3
Latest Photos
Chinese Buddhist temple.
My buddha beads.
Rendered Walls
Multi-Screen wallpaper
Stockholm Metro
Previous Thread
Next Thread
Print Thread
How do I force all "non-WWW" url requests to my "www" domain? #188515
06/24/07 02:14 AM
06/24/07 02:14 AM
Joined: Jun 2006
Posts: 16,784
Portland, OR; USA
Gizmo Offline OP
UBB.threads Developer
Gizmo  Offline OP
UBB.threads Developer
Joined: Jun 2006
Posts: 16,784
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.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Forums: A Gardeners Forum Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
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."
Re: How do I force all "non-WWW" url requests to my "www" domain? [Re: Gizmo] #194057
08/07/07 07:38 PM
08/07/07 07:38 PM
Joined: Jun 2006
Posts: 16,784
Portland, OR; USA
Gizmo Offline OP
UBB.threads Developer
Gizmo  Offline OP
UBB.threads Developer
Joined: Jun 2006
Posts: 16,784
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]

Last edited by Gizmo; 08/03/11 01:35 AM.

I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Forums: A Gardeners Forum Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!

Shout Box
Today's Birthdays
No Birthdays
Recent Topics
Shout Box Sound Effect
by M4TT. 11/29/17 08:28 PM
Ad island
by TGCsanderson. 11/25/17 06:41 PM
Taking to long to connect to DB
by AstroCat. 11/24/17 12:34 PM
I want to update forum but can't find license
by dimaninc. 11/23/17 10:51 AM
Forum Statistics
Forums36
Topics35,014
Posts190,529
Members12,045
Most Online978
Jun 24th, 2007
Random Image
Powered by UBB.threads™ PHP Forum Software 7.6.1
(Snapshot build 20171106)