# \[ mode\_rewrite \] basic domain redirect problem (kinda urgent...)

**URL:** <https://forum.kirupa.com/t/mode-rewrite-basic-domain-redirect-problem-kinda-urgent/163016>\
**Category:** programming\
**Created:** [September 19, 2005, 1:03am UTC](https://forum.kirupa.com/t/mode-rewrite-basic-domain-redirect-problem-kinda-urgent/163016 "2005-09-19T01:03:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![minimaldesign](https://avatars.discourse-cdn.com/v4/letter/m/eb9ed0/32.png) [@minimaldesign](https://forum.kirupa.com/u/minimaldesign)\
**Post date:** [September 19, 2005, 1:03am UTC](https://forum.kirupa.com/t/mode-rewrite-basic-domain-redirect-problem-kinda-urgent/163016/1 "2005-09-19T01:03:31Z")

</div>

So here’s my basic problem that I can’t solve even after going through the mode\_rewrite documentation (I guess my regex knowledge is just too sucky…):

I got this client’s site (going online VERY soon…) that has 3 domain names pointing to it. I need any URI pointing to either one to be redirected to the main URL + keeping the Query string and the file name BUT without the extension (.php in that case).

Here are a few examples:

http://www.example\_one.com -\> http://example\_one.com  
http://www.example\_two.com -\> http://example\_one.com  
http://example\_two.com -\> http://example\_one.com  
http://www.example\_two.com/file.php -\> http://example\_one.com/file  
http://www.example\_two.com/file.php?var=1 -\> http://example\_one.com/file?var=1

My guess is that you need one mode\_rewrite rule just to strip the “.php” from the URI and then one for each additional domain that need to go to the main domain… But everything I tried just failed pathetically…

Any regex/mode\_rewrite gurus in the house yo?

Thanks!
