1

I need help with some rules in ISAPI_Rewrite in my installation. (If you only know mod_rewrite could be a good help to, so I would adapt the configuration).

I'm going to be very honest about my needs. I need to do this configuration in the next few hours, and don't have time right now understand everything about rewrites, regular expressions and such. I really think you can help me, if I had more reputation I would even set up a bounty... :(

In fact, I believe that what I need is simple:

I have a .com domain. The main url of my website is going to be http:// www.mainurl.com/. I have two other domains: mainurl.net and mainurl.org.

What I need (in isapi-rewrite 2, the config made with httpd.ini file in root file) is: everytime someone writes mainurl.net in browser it becomes http:// www.mainurl.com/ 301 redirect. If it's written without www becomes http:// www.mainurl.com/. If someone writes mainurl.net/about it becomes http:// www.mainurl.com/about/. Redirect always the .com, the www part and the final slash /.

Thanks in advance you all!

  • 1
    Why the -1? Is it because I said I just want the answer? Being honest isn't a good think to do, I think. Next time I will just ask the question... – Somebody still uses you MS-DOS Mar 15 '10 at 03:43
  • 1
    @user: I didn't downvote (just voted to move it to serverfault), but I can tell you I don't like the implication that _because_ you're in a hurry, we're to hurry answering you. – John Saunders Mar 15 '10 at 03:54
  • 1
    I agree with you: I'm not saying you have to answer me in a hurry... I'm just saying I can't read a lot of manuals, and learn regular expressions and all documentation from a module in a server I'm not going to use for nothing more than this configuration. Some people may be "offended" when I said that, because "We're not here to work for you" when I said I just want the answer. I didn't mean that. I think this is unfair, since I always try to upvote and accept all answers people write, and was just being honest in my question. – Somebody still uses you MS-DOS Mar 15 '10 at 04:16

1 Answers1

1

Your ISAPI_Rewrite2 syntax will be:

[ISAPI_Rewrite]

RewriteCond Host: (mailurl\.(?:net|org|com))
RewriteRule (.*?)(/)? http\://www.$1$2(?3:/) [R]

RewriteCond Host: www\.mainurl\.(?:net|org)
RewriteRule (.*) http:// www.mainurl.com$1 [RP]
TonyCool
  • 1,004
  • 1
  • 6
  • 5
  • I'm still having some problems with mainurl.net/index.html to redirect to mainurl.com/index.html, it becomes mainurl.com/index.html/... I know it's not your fault, my example that was poor... but everything else was working perfectly!! Thanks a lot!!! – Somebody still uses you MS-DOS Mar 16 '10 at 04:02
  • I'm checking your answer as accepted it's already a really good one. If it's not asking too much, I would like to fix the problem I described in the last comment... anyways, thanks!! – Somebody still uses you MS-DOS Mar 16 '10 at 04:04
  • Please try to fix the config in the following way: [ISAPI_Rewrite] RewriteCond Host: (.*) RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [R] RewriteCond Host: (mailurl\.(?:net|org|com)) RewriteRule (.*) http\://www.$1$2 [R] RewriteCond Host: www\.mainurl\.(?:net|org) RewriteRule (.*) http:// www.mainurl.com$1 [RP] – TonyCool Mar 16 '10 at 11:30