| 6:15 am on Sep 25, 2012 (gmt 0)|
Looks like you haven't been around in a while-- unless you're a very devoted lurker-- so start by reading the thread about using example.com. Look at your own post and you will see the point.
A RewriteRule can only see the "body" of an URL. Anything involving domains and/or queries has to go into a RewriteCond.
But before you do too much work, check with your host. A lot of them will do this kind of routine redirection for you, so you don't have to mess with htaccess if it alarms you.
| 6:21 am on Sep 25, 2012 (gmt 0)|
what was the status code?
THE_REQUEST is going to begin with the HTTP Request method such as GET or POST so your RewriteCond will always be false.
in your case the RewriteCond is probably unnecessary.
what is your canonical hostname?
in your problem statement you use example.com yet you use www.example.com in your RewriteRule.
| 6:39 am on Sep 25, 2012 (gmt 0)|
^(www\.)? in the condition with
_ is a space should get you closer.
You should not be redirecting to a named index.html file. The canonical URL for the site root ends with a trailing slash.
| 7:00 am on Sep 25, 2012 (gmt 0)|
Oops. My bad. I didn't read your question closely enough or I'd have seen that the problem is duplication. Somewhere in the past you goofed in a redirect and came out with something like
Have I got that right?
If so, you don't need a condition at all. The element "example.com" will never be part of an URL-- other than in the "domain" slot, where the RewriteRule can't see it. And unlike "index.html" or equivalent it will never be supplied by anything operating behind the scenes, so you don't need to look at THE_REQUEST. When you redirect
(that is, "www.example.com/example.com/" possibly ending in directory slash followed by an explicit "index.html")
the "index.html" part will quietly disappear if it was there, and your domain name-- the real one-- will get canonicalized. So that's three birds with one stone ;)
| 6:43 am on Sep 26, 2012 (gmt 0)|
Thank you phranque & lucy24, I will remove the condition and report back.
I've been letting my site run on auto pilot, but now it has 10,000 visitors a day I figured it is time to earn some adsense revenue off it.
| 9:46 pm on Sep 26, 2012 (gmt 0)|
This works, for everything except my domain name. If I try a random example...
RewriteRule ^fred\.com/(.*)$ http://www.example.com/$1 [R=301,L]
Then http://www.example.com/fred.com/puzzles is rewritten as http://www.example.com/puzzles
If I try my domain name
RewriteRule ^example\.com/(.*)$ http://www.example.com/$1 [R=301,L]
Then http://www.example.com/example.com/puzzles remains unchanged... Help?