| Author |
|
jpresser Newbie

Joined: 25 August 2008 Location: United States
Online Status: Offline Posts: 16
|
| Posted: 22 September 2008 at 6:44pm | IP Logged
|
|
|
Hello,
Is there a way to use to map to 3 seperate sites using the same IP address that use host headers in IIS that point them to different sites. For example if my DNS is set like
10.16.30.34 crmintmysite 10.16.30.34 crmintcollab 10.16.30.34 crmintintra
For one of these I could use something like
#For crmdmossdev RewriteEngine on RewriteBase / RewriteMap mapfile txt:mapfile.txt RewriteCond %{HTTP_HOST} ^c$ RewriteRule (.+) http://crmdmossdev/\L${mapfile:$1}\E
Where C here is like crmintcollab. The problem that I see is the ReWriteRule has http://cmrdmossdev hard coded in it. Is there a way to put the http:// into the mapfile so the user can type crmintCollab/sitename to go to there site? Then if a user types crmintintra/sitename it goes to the crmintra site instead. Hope this is clear.
I currently have it working for a single DNS entry.
Thank you for the help
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4837
|
| Posted: 25 September 2008 at 7:36am | IP Logged
|
|
|
If you have 3 separate sites the you can either put your rules into httpd.conf or put .htaccess file into the root of each of them.
And, yes, you may put http://etc into you map file.
__________________ Regards,
Anton
|
| Back to Top |
|
| |
jpresser Newbie

Joined: 25 August 2008 Location: United States
Online Status: Offline Posts: 16
|
| Posted: 25 September 2008 at 6:12pm | IP Logged
|
|
|
Anton,
How do I put the httpd.conf. I tried putting one rule in the file and it seemed like it was ignored. Is there some configuration that is necessary to make this work?
Thanks for the help
Jim
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4837
|
| Posted: 26 September 2008 at 5:13am | IP Logged
|
|
|
httpd.conf resides in ISAPI_Rewrite installation folder.
Please try adding smth like this:
AllowOverride none
<VirtualHost onesite.com>
RewriteEngine on
AllowOverride all
//Your rules for first site
</VirtualHost>
<VirtualHost othersite.com>
RewriteEngine on
AllowOverride all
//Your rules for second site
</VirtualHost>
__________________ Regards,
Anton
|
| Back to Top |
|
| |
jpresser Newbie

Joined: 25 August 2008 Location: United States
Online Status: Offline Posts: 16
|
| Posted: 26 September 2008 at 12:39pm | IP Logged
|
|
|
Anton,
When I tired putting the rules into the httpd.conf file the redirects just comes up with a page cannot be found message. The same exact formula in the .htaccess redirects to the site fine.
Here is the code in my httpd.conf file:
RewriteLogLevel 9 RewriteLog rewrite.log LogLevel debug
AllowOverride none
<VirtualHost ussydmsp01> RewriteEngine on AllowOveride all RewriteBase / RewriteMap mapfile txt:mapfile.txt RewriteCond %{HTTP_Host} ^y$ (Where y points to the IP address of the server that ISAP.Rewrite is installed on) RewriteRule (.+) http://ussydmsp01/\L${mapfile:$1}\E
</VirtualHost>
The error log has the following in it:
[9/26/2008 09:54:00] Map file c:\program files\helicon\isapi_rewrite3\mapfile.txt - Loaded successfully [9/26/2008 09:54:00] C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf - Loaded successfully
The Rewrite.log contains:
150.202.71.34 150.202.71.34 Fri, 26-Sep-2008 09:54:00 GMT [y/sid#1][rid#17899456/initial] (2) init rewrite engine with requested uri /test1 150.202.71.34 150.202.71.34 Fri, 26-Sep-2008 09:54:00 GMT [y/sid#1][rid#17899456/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
ussydmsp01 is the server that the SharePoint site is on. I also tried replacing the <VirtualHost ussydmsp01> with ussydmsp01 IP address. I got the same result of page cannot be displayed.
If rules run from the htaccess then evrything works.
Thanks so much for the help with this
Jim
|
| Back to Top |
|
| |
jpresser Newbie

Joined: 25 August 2008 Location: United States
Online Status: Offline Posts: 16
|
| Posted: 26 September 2008 at 6:27pm | IP Logged
|
|
|
Anton
Addtional information from first post
I found out that if I remove the VirtualHost tag or use <VirtualHost *> then the rule executes. How can I specify the tag for the three sites that are that I need to point two.
My host file point to IIS knows that crmintintra goe to http://crmintintra/pages/default.aspx
crmintcollab goes to http://crmintcollab/pages/default.aspx
Both sites are on ussydmsp01 and are SharePoint sites. IIS knows which site each address goes to.
Thanks
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4837
|
| Posted: 29 September 2008 at 4:37am | IP Logged
|
|
|
Please try to use <VirtualHost *> directive.
Make a request to match your rules and provide us all rewrite log records for that request.
__________________ Regards,
Anton
|
| Back to Top |
|
| |
jpresser Newbie

Joined: 25 August 2008 Location: United States
Online Status: Offline Posts: 16
|
| Posted: 29 September 2008 at 6:39pm | IP Logged
|
|
|
Anton,
Here is the Rewrite log with <VirtualHost *>
150.202.71.34 150.202.71.34 Mon, 29-Sep-2008 16:08:21 GMT [y/sid#1][rid#17899160/initial] (2) init rewrite engine with requested uri /test1 150.202.71.34 150.202.71.34 Mon, 29-Sep-2008 16:08:21 GMT [y/sid#1][rid#17899160/initial] (1) Htaccess process request 150.202.71.34 150.202.71.34 Mon, 29-Sep-2008 16:08:21 GMT [y/sid#1][rid#17899160/initial] (3) applying pattern '(.+)' to uri 'test1' 150.202.71.34 150.202.71.34 Mon, 29-Sep-2008 16:08:21 GMT [y/sid#1][rid#17899160/initial] (4) RewriteCond: input='y' pattern='^y$' => matched 150.202.71.34 150.202.71.34 Mon, 29-Sep-2008 16:08:21 GMT [y/sid#1][rid#17899160/initial] (5) map lookup OK: map=mapfile[txt] key=test1 -> val=testsite 150.202.71.34 150.202.71.34 Mon, 29-Sep-2008 16:08:21 GMT [y/sid#1][rid#17899160/initial] (1) escaping http://crmintcollab/testsite 150.202.71.34 150.202.71.34 Mon, 29-Sep-2008 16:08:21 GMT [y/sid#1][rid#17899160/initial] (2) explicitly forcing redirect with http://crmintcollab/testsite 150.202.71.34 150.202.71.34 Mon, 29-Sep-2008 16:08:21 GMT [y/sid#1][rid#17899160/initial] (2) rewrite 'test1' -> 'http://crmintcollab/testsite' 150.202.71.34 150.202.71.34 Mon, 29-Sep-2008 16:08:21 GMT [y/sid#1][rid#17899160/initial] (2) internal redirect with /test1 [INTERNAL REDIRECT]
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4837
|
| Posted: 30 September 2008 at 5:32am | IP Logged
|
|
|
So, if you use <VirtualHost *> it works and if you are specifying host names, it doesn't?
Please try to put them like this:
<VirtualHost onesite.com othersite.com thirdsite.com>
__________________ Regards,
Anton
|
| Back to Top |
|
| |
jpresser Newbie

Joined: 25 August 2008 Location: United States
Online Status: Offline Posts: 16
|
| Posted: 30 September 2008 at 1:27pm | IP Logged
|
|
|
I tried crmintcollab.com, I again got the page cannot be displayed.
<VirtualHost crmintcollab.com>
Here is the Rewrite.log: 150.202.71.34 150.202.71.34 Tue, 30-Sep-2008 10:58:27 GMT [y/sid#1][rid#17899160/initial] (2) init rewrite engine with requested uri /test1
I also tried ussydmsp01.com with no luck.
|
| Back to Top |
|
| |
jpresser Newbie

Joined: 25 August 2008 Location: United States
Online Status: Offline Posts: 16
|
| Posted: 30 September 2008 at 2:10pm | IP Logged
|
|
|
Is it possible to change the rule: RewriteRule (.+) http://crmintcollab/\L${mapfile:$1}\E
so that the http://ussydmsp01 or at least the ussydmsp01 is obtained from the mapfile?
I currently have crmintcollab, crmintintra, and crmintmysite so with the <VirtualHost> idea I would have 3 rules for the three site
RewriteRule (.+) http://crmintcollab/\L${mapfile:$1}\E RewriteRule (.+) http://crmintintra/\L${mapfile:$1}\E RewriteRule (.+) http://crmintmysite/\L${mapfile:$1}\E
Is there a way to combine these rules into one rule?
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4837
|
| Posted: 01 October 2008 at 3:57am | IP Logged
|
|
|
Please try to use the following config without VirtualHost:
RewriteCond %{HTTP_Host} ^(y)|(c)$
RewriteRule (.+) http://(?%1crmintcollab)(?%2crmintintra)/\L${mapfile:$1}\E
__________________ Regards,
Anton
|
| Back to Top |
|
| |
jpresser Newbie

Joined: 25 August 2008 Location: United States
Online Status: Offline Posts: 16
|
| Posted: 01 October 2008 at 11:19am | IP Logged
|
|
|
Anton,
What is c in this formula? Do I need c or is this just saying choose y or c?
Thanks
Jim
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4837
|
| Posted: 02 October 2008 at 4:58am | IP Logged
|
|
|
c as well as y are host names (you provided c as a hostname in one of your configs), so depending on requested host you will be directed
either to 1crmintcollab or to 2crmintintra.
__________________ Regards,
Anton
|
| Back to Top |
|
| |
jpresser Newbie

Joined: 25 August 2008 Location: United States
Online Status: Offline Posts: 16
|
| Posted: 06 October 2008 at 5:45pm | IP Logged
|
|
|
Anton,
This rule:
#For crmdmossdev RewriteEngine on RewriteBase / RewriteMap mapfile txt:mapfile.txt RewriteCond %{HTTP_HOST} ^c$ RewriteRule (.+) http://(?%1crmdmossdev)/\L${mapfile:$1}\E
Is not working the Rewrite.Log shows the following:
192.168.150.129 192.168.150.129 CRMDMOSSDEV\Administrator Mon, 06-Oct-2008 15:16:07 GMT [c/sid#402453075][rid#20258456/initial] (2) init rewrite engine with requested uri /test3 192.168.150.129 192.168.150.129 CRMDMOSSDEV\Administrator Mon, 06-Oct-2008 15:16:07 GMT [c/sid#402453075][rid#20258456/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf 192.168.150.129 192.168.150.129 CRMDMOSSDEV\Administrator Mon, 06-Oct-2008 15:16:07 GMT [c/sid#402453075][rid#20258456/initial] (1) Htaccess process request c:\inetpub\wwwroot\wss\virtualdirectories\80\.htaccess 192.168.150.129 192.168.150.129 CRMDMOSSDEV\Administrator Mon, 06-Oct-2008 15:16:07 GMT [c/sid#402453075][rid#20258456/initial] (3) applying pattern '(.+)' to uri 'test3' 192.168.150.129 192.168.150.129 CRMDMOSSDEV\Administrator Mon, 06-Oct-2008 15:16:07 GMT [c/sid#402453075][rid#20258456/initial] (4) RewriteCond: input='c' pattern='^c$' => matched 192.168.150.129 192.168.150.129 CRMDMOSSDEV\Administrator Mon, 06-Oct-2008 15:16:07 GMT [c/sid#402453075][rid#20258456/initial] (5) map lookup OK: map=mapfile[txt] key=test3 -> val=MossSite2 192.168.150.129 192.168.150.129 CRMDMOSSDEV\Administrator Mon, 06-Oct-2008 15:16:07 GMT [c/sid#402453075][rid#20258456/initial] (1) escaping http:///MossSite2 192.168.150.129 192.168.150.129 CRMDMOSSDEV\Administrator Mon, 06-Oct-2008 15:16:07 GMT [c/sid#402453075][rid#20258456/initial] (2) explicitly forcing redirect with http:///MossSite2 192.168.150.129 192.168.150.129 CRMDMOSSDEV\Administrator Mon, 06-Oct-2008 15:16:07 GMT [c/sid#402453075][rid#20258456/initial] (2) rewrite 'test3' -> 'http:///MossSite2' 192.168.150.129 192.168.150.129 CRMDMOSSDEV\Administrator Mon, 06-Oct-2008 15:16:07 GMT [c/sid#402453075][rid#20258456/initial] (2) internal redirect with /test3 [INTERNAL REDIRECT]
The redirect should be http://crmdMossDev/Mossite2, it seems to trying to redirect to http://MossSite2 which is in the Mapfile.
Thanks
Jim
|
| Back to Top |
|
| |
Anton Moderator Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 4837
|
| Posted: 07 October 2008 at 3:55am | IP Logged
|
|
|
Your config should look like this:
RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt
RewriteCond %{HTTP_HOST} ^c$
RewriteRule (.+) http://crmdmossdev/\L${mapfile:$1}\E
__________________ Regards,
Anton
|
| Back to Top |
|
| |