Msg#: 4473601 posted 7:36 am on Jul 8, 2012 (gmt 0)
Uhm... Your question reads as if it's a continuation from an ongoing thread. I don't think it really is. But I think you've become so absorbed in the problem that you forget we're hearing about it for the first time.
In English: What are you trying to do? At a guess, you want to redirect everyone to the canonical version of your site name-- with or without www-- but I'm not betting money on it.
Before you answer, read the post at the top of this Forum about using example.com. Matter of fact, read some random other posts and you may never need to come back at all. This is an amazingly repetive Forum. Maybe something about Apache makes people afraid to look at other people's questions even if they seem to be identical.
In mod_rewrite you do not need to escape / slashes. As far as I know, you never need to escape colons anywhere. You do need to escape literal periods. BUT you do not need to escape anything at all, whatsoever, of any kind, in the target (the part on the right).
Now, about that mile-long query string that you haven't even mentioned... ;)
Msg#: 4473601 posted 10:52 am on Jul 8, 2012 (gmt 0)
Redirects works fine if i use http://example.com which redirects it to http://www.example.com
Ah, but what if you had said www.example.com in the first place? You would still be redirected, and the request would go around in circles until the user's browser (not your server) put a stop to it.
General rule: When testing something, don't only test it on things that are supposed to work. Also test it on things that are not supposed to work-- or that are supposed to not work, depending on how you look at it. And test it on garbage to make sure it's GIGO. (This is what is supposed to happen.)
Here you need a RewriteCond to ensure that only the right things-- er, that is, the wrong things-- get redirected. Exact wording will be found in many many threads in this forum. Conceptually what you need to say is: "If the requested host is NOT exactly such-and-such, then redirect to such-and-such".
As Tolstoy said: correct URLs are all alike. Incorrect URLs are each incorrect in their own way.