icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.
Old July 10th, 2007, 11:43 PM   #1 (permalink)
Registered User
Fresh Surpasser
 
Joined in Sep 2006
Hosted on Gotti
10 posts
Gave thanks: 1
Thanked 0 times
Post How do I redirect www. to no www?

Hello,
I have http://wb7tjd.org/ which also comes up as http://www.wb7tjd.org/. I can go into cpanel and do a 301 redirect to make http://wb7tjd.org become www.wb7tjd.org. But is there a way to go the other way around? WB7TJD is an amateur radio call sign, and with it starting with a W, I just have been reluctant to put 3 more "double-you's" in front of it.

I don't want to use Javascript and Meta tag approaches to perform the redirect, as they may cause issues with the search engines and Back Button functionality.

Using Google's Webmaster tools, I have advised my preference for http://wb7tjd.org/.

Thanks in advance.
Larry_Kuck is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old July 11th, 2007, 12:07 AM   #2 (permalink)
He shoots.. He scores!
Super #1
 
puckchaser's Avatar
 
Joined in Feb 2007
Lives in A room with no windows.
Hosted on SH110
1,447 posts
Gave thanks: 46
Thanked 140 times
Put this code in your .htaccess file in your root directory.

Code:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} www.wb7tjd.com [nc]
rewriterule ^(.*)$ http://wb7tjd.com/$1 [r=301,nc]

I just tried this on one of my domains, so I know it works.....
__________________
SH110
puckchaser is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old July 11th, 2007, 4:33 AM   #3 (permalink)
Registered User
Fresh Surpasser
 
Joined in Sep 2006
Hosted on Gotti
10 posts
Gave thanks: 1
Thanked 0 times
Thank you for the quick response, Puckchaser.
I already have this code in my root .htaccess:
Code:
 
RewriteEngine on
RewriteRule .*\.()$ - [F,NC]
So would I replace this with your code and then just
add my existing RewriteRule to your code?

It would look like this:
Code:
 
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} www.wb7tjd.com [nc]
rewriterule ^(.*)$ http://wb7tjd.com/$1 [r=301,nc]
RewriteRule .*\.()$ - [F,NC]
While I await your response, I will see if I can find
out what these codes mean, and perhaps re-educate
myself on the .htaccess file.

It's a mighty fine friend to have, as I have dealt with
free hosts that do not support my use of it!
Larry_Kuck is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old July 11th, 2007, 6:08 AM   #4 (permalink)
Registered User
Fresh Surpasser
 
Joined in Sep 2006
Hosted on Gotti
10 posts
Gave thanks: 1
Thanked 0 times
Meaning of "RewriteRule .*\.()$ - [F,NC]"?

One more follow-up:

Your code works exactly as I was hoping for.
I replaced my code snippet with yours, and
added my RewriteRule to the end.

I am still looking for a reference that just
defines the symbols I have and tells me what that
rule of mine is supposed to do.

Thanks again for your quick response to my first
question, Puckchaser!

Larry
Larry_Kuck is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old July 11th, 2007, 12:09 PM   #5 (permalink)
ceo
Senior Member
Super #1
 
Joined in Jan 2005
1,546 posts
Gave thanks: 70
Thanked 33 times
The code that you had originally is basically the beginning and ending of htaccess code to do... well a bunch of things - redirects, disabling file views, etc. Without stuff in the middle, uh, it doesn't do anything.

Here's a very good breakdown of htaccess code, specifically in regards to hotlink prevention. Hope that helps you out!
ceo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old July 14th, 2007, 3:44 AM   #6 (permalink)
Registered User
Fresh Surpasser
 
Joined in Sep 2006
Hosted on Gotti
10 posts
Gave thanks: 1
Thanked 0 times
Thanks CEO! I no longer have a list of blocked spambots and this original code might be the empty start and end of of that code block.

Your article link is greatly appreciated. Thank you.
Larry_Kuck is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old July 14th, 2007, 11:21 AM   #7 (permalink)
ceo
Senior Member
Super #1
 
Joined in Jan 2005
1,546 posts
Gave thanks: 70
Thanked 33 times
You're very welcome! Always glad to help! ^_^
ceo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may post new threads
You may post replies
You may post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On