|
|
#1 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Sep 2006
Hosted on Gotti
10 posts
Gave thanks: 1
Thanked 0 times
|
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. |
|
|
|
|
|
#2 (permalink) |
|
He shoots.. He scores!
Super #1
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
|
|
|
|
|
|
#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] 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]
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! |
|
|
|
|
|
#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 |
|
|
|
|
|
#5 (permalink) |
|
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! |
|
|
|
|
|
#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. |
|
|
|