Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online Now
3 registered members (Gizmo, PianoWorld, JAISP), 74 guests, and 233 spiders.
Key: Admin, Global Mod, Mod
Member Spotlight
Steve C
Steve C
California
Posts: 245
Joined: May 2006
Show All Member Profiles 
Top Posters(30 Days)
isaac 22
Gizmo 17
TheBrit 14
Zarzal 12
SteveS 8
Ruben 4
jorb 4
Latest Photos
Test
Testing to drag photos
Comfortable Cats
Test
BSA photos
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
Gizmo  Online Tapedshut OP
UBB.threads Developer
Joined: Jun 2006
Posts: 17,016
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.
Need to Upgrade?
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
Gizmo  Online Tapedshut OP
UBB.threads Developer
Joined: Jun 2006
Posts: 17,016
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.
Need to Upgrade?
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
Calendar Function
by TheBrit. 12/17/18 10:05 PM
Speaking of Http to https, complaints from user
by PianoWorld. 12/16/18 03:40 PM
update multilanguage site problem
by Zarzal. 12/15/18 04:20 PM
Char coding utf-8 and older forums
by Zarzal. 12/15/18 03:59 PM
table issue
by TheBrit. 12/13/18 06:05 PM
Forum Statistics
Forums36
Topics35,182
Posts191,701
Members12,122
Most Online978
Jun 24th, 2007
Random Image
Powered by UBB.threads™ PHP Forum Software 7.6.2