Drop www in url address with .htaccess
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexHelp
Author Message
warden
Silver Supporter


Joined: Dec 16, 2004
Posts: 196
Location: North Carolina

PostPost subject: Drop www in url address with .htaccess
Posted: Thu Feb 22, 2007 1:11 am
Reply with quote

At no-www.org it contains code to place into the .htaccess file to redirect all traffic from a "www." url to the same domain.com without the www. within the url. I have this code in a 9.0.6.1 address and it works fine:

Quote:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

The code on the no-www.org site says, substitute your domain name with the word domain:
Quote:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ domain.com/$1 [R=301,L]

I tried both of these codes to a 9.1.1 site and neither worked. Does anyone have any ideas on how to make this work? If it is possible, could this be implemented as an option in the htaccess file to be commented or uncommented? Thanks.


warden's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website
sarah
Debugger


Joined: Mar 25, 2005
Posts: 2131

PostPost subject: Re: Drop www in url address with .htaccess
Posted: Thu Feb 22, 2007 1:58 am
Reply with quote

First one works for me on 9.1.1, second one doesn't. What does the first one do when you try to use it?
_________________
Diagon Alley - Top Design

sarah's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/1.3.37/4.1.21-standard/4.4.4/9.1.1
Back to top
View user's profile Send e-mail Visit poster's website
warden
Silver Supporter


Joined: Dec 16, 2004
Posts: 196
Location: North Carolina

PostPost subject: Re: Drop www in url address with .htaccess
Posted: Thu Feb 22, 2007 12:11 pm
Reply with quote

It doesn't do anything. I enter the url as www.name.com and the "www." does not get dropped from the url address. I was wondering if there was anything else in the htaccess file that would interfere with this in DF 9.1.1.

warden's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website
xfsunoles
XHTML Specialist


Joined: Apr 30, 2004
Posts: 2502
Location: Melbourne, Florida

PostPost subject: Re: Drop www in url address with .htaccess
Posted: Thu Feb 22, 2007 5:32 pm
Reply with quote

Did your replace to ^www\.domain\.com to ^www\.name\.com?
_________________

Firefox is my Favorite Browser

xfsunoles's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Apache/1.3.34 (Unix)/4.0.25-standard/4.4.1/CVS
Back to top
View user's profile Visit poster's website AIM Address MSN Messenger Yahoo Messenger
warden
Silver Supporter


Joined: Dec 16, 2004
Posts: 196
Location: North Carolina

PostPost subject: Re: Drop www in url address with .htaccess
Posted: Thu Feb 22, 2007 9:05 pm
Reply with quote

Yes, I did replace it with the actual domain name... (-;

Thanks for asking though.


warden's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page     Forum IndexHelp All times are GMT
Page 1 of 1


Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Dedicated Server & Bandwidth Sponsored by DedicatedNOW
User Info [x]

Welcome Anonymous

Nickname
Password
(Register)

Last CVS commits [x]

Languages [x]

Community [x]

Support for DragonflyCMS in a other languages:

Deutsch
Español

X-links [x]
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

Preview theme [x]
Each user can view the site with a different theme.
Themes marked with a * also change the forum look.


You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
This page generated in 0.4235 seconds with 16 DB Queries in 0.0813 seconds
Memory Usage: 2.89 MB
Interactive software released under GNU GPL, Code Credits, Privacy Policy