Site Links
Home
Features
Documentation
Pricing & Order
Members Area
Support Options
UBBDev.com
UBBWiki.com
Who's Online Now
1 registered members (mmkk), 74 guests, and 391 spiders.
Key: Admin, Global Mod, Mod
Member Spotlight
Posts: 82
Joined: September 2008
Show All Member Profiles 
Top Posters(30 Days)
Gizmo 18
M4TT 12
FREAK 11
Ruben 8
isaac 4
mmkk 4
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,788
Portland, OR; USA
Gizmo Offline OP
UBB.threads Developer
Gizmo  Offline OP
UBB.threads Developer
Joined: Jun 2006
Posts: 16,788
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,788
Portland, OR; USA
Gizmo Offline OP
UBB.threads Developer
Gizmo  Offline OP
UBB.threads Developer
Joined: Jun 2006
Posts: 16,788
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
Users Unable to Upload Avatar [Not a Bug]
by M4TT. 12/13/17 08:51 AM
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
Forum Statistics
Forums36
Topics35,015
Posts190,544
Members12,045
Most Online978
Jun 24th, 2007
Random Image
Powered by UBB.threads™ PHP Forum Software 7.6.1
(Snapshot build 20171106)