This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
Common Questions (Forum Locked Forum Locked)
 Helicon Tech : Common Questions
Subject Topic: Problem writing correct httpd.ini (Topic Closed Topic Closed)
Author
Message |
Tweety77
Newbie


Joined: 24 July 2007
Posts: 6
Posted: 24 July 2007 at 5:54am  

At
Back to Top
 
Tweety77
Newbie


Joined: 24 July 2007
Posts: 6
Posted: 24 July 2007 at 6:01am  

Big fingers

I want to get working the next situation:

url www.a.nl must point to /site.a.nl

url www.b.nl must point to /site.b.nl

url www.c.nl must point to /site.c.nl

But,

www.a.nl/app.~ must point to /app.~

www.b.nl/app.~ must point to /app.~

www.c.nl/app.~ must point to /app.~

And

www.a.nl/site.~ must point to /site.~

www.b.nl/site.~ must point to /site.~

etc.

in short, if there is /app. or /site. in the url the url must not be rewrited, in all other cases it should rewrite it.

Using next httpd.ini:

[ISAPI_Rewrite]
#
RewriteCond Host: (www\.)?(.+)(/app\..*|/site\..*)
RewriteRule (.*) $3$4 [I,L]
#
RewriteCond Host: (www\.)?(.+)
RewriteRule (.*) /site\.$2$3 [I,L]
#END

Working nicely for the normal rule (www.a.nl -> www.a.nl/site.a.nl)

but when i typed in www.a.nl/app.new it goes to www.a.nl/site.a.nl/app.new , processing the 2nd rule also, while using the [L] flag in first rule

Can someone help me to archive my whishes?

Back to Top
 
Yaroslav
Admin Group


Joined: 15 August 2002
Posts: 6520
Posted: 25 July 2007 at 5:53am  

RewriteCond Host: www\.(.*)
RewriteRule / /site.$1 [I,L]

__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top Visit Yaroslav's Homepage
 
Tweety77
Newbie


Joined: 24 July 2007
Posts: 6
Posted: 25 July 2007 at 8:45am  

Nice, indeed it works, goes to the right map on the server.

But with this solution i encounter some other problems:

- In the addressbar there is showing the full generated url; typed in : www.aaa.nl and shows www.aaa.nl/site.aaa.nl. I don't want that happen, (it wasn't before);

- In the site i'm using XMLHTTPrequests... in the new situation it doesn't work, due to the fact that the javascript file is not loaded.

Back to Top
 
Yaroslav
Admin Group


Joined: 15 August 2002
Posts: 6520
Posted: 25 July 2007 at 10:38am  

1. If it shows full path in address bar then there is some redirect somewhere. ISAPI_Rewrite does not issue this redirect, so try to find wthe reason and remove it.
2. Possibly document base location problem. Try to change links on page to reflect new virtual location of the document.

__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top Visit Yaroslav's Homepage
 
Tweety77
Newbie


Joined: 24 July 2007
Posts: 6
Posted: 25 July 2007 at 11:41am  

1) Checked all coding for redirects, no one found. If using

RewriteCond (www\.)?(.+)

RewriteRule (.*) /site\.$2 [I,L]

No redirect is shown; but when using

RewriteCond (www\.)?(.+)

RewriteRule / /site\.$2 [I,L]

it shows the redirected url.

2) using relative url fixed the problem.

Back to Top
 
Yaroslav
Admin Group


Joined: 15 August 2002
Posts: 6520
Posted: 26 July 2007 at 7:28am  

Oh, sorry, this is a "feature" of IIS I forgot. Try this:

RewriteCond (www\.)?(.+)
RewriteRule / /site\.$2/ [I,L]

__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top Visit Yaroslav's Homepage
 
Tweety77
Newbie


Joined: 24 July 2007
Posts: 6
Posted: 26 July 2007 at 9:19am  

Tried and worked, but all images(relative), direct url's to files etc doesn't work then (logical, 'www.aaa.nl/site.aaa.nl/images/image.gif/' doesn't exists). I tried to correct this with the part below (in blue) but that doesn't work either.

I liked to correct this in the isapi script ofcourse, but tips are welcome

RewriteCond Host: (www\.)?(.+)(/app\..*|/site\..*)
RewriteRule (.*) $3$4 [I,L]
#
RewriteCond Host: (www\.)?(.+)(/.+\.(asp|htm|html|gif|png|jpg|js|css).*)+
RewriteRule / /site\.$2$3 [I,L]
#
RewriteCond Host: (www\.)?(.+)
RewriteRule / /site\.$2/ [I,L]

Back to Top
 
Yaroslav
Admin Group


Joined: 15 August 2002
Posts: 6520
Posted: 27 July 2007 at 4:13am  

You can fix the problem by setting correct <BASE> tag on your page.

__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top Visit Yaroslav's Homepage
 
Tweety77
Newbie


Joined: 24 July 2007
Posts: 6
Posted: 02 August 2007 at 7:47am  

For all those who are interested, found the solution to my mentioned problem, trick was using RewriteCond URL instead of the previous used RewriteCond Host:.

Complete solution:

[ISAPI_Rewrite]
#Check if /app. or /site. url and if with direct file
RewriteCond URL .*(/app\.|/site\.)+(.*)
  RewriteRule .*(\.asp|\.asp\?.*|\.htm|\.html|\.gif|\.png|\.jpg|\.js|\.css)+ /$1$2 [I,L]
#
#Check if /app. or /site. url, is without file, but with / on end
RewriteCond URL .*(/app\.|/site\.)+(.*)(/$)+
  RewriteRule .* /$1$2/ [I,L]
#
#if /app. or /site. then it is without direct file, and without / on end, rewrite
RewriteCond URL .*(/app\.|/site\.)+(.*)
  RewriteRule .* /$1$2/ [I,L]
#
#All rows below automaticly not /app. or /site. urls, so pick up Host:
#Check for direct file access
RewriteCond Host: (www\.)?(.+)
  RewriteRule (.*)(\.asp|\.asp\?.*|\.htm|\.html|\.gif|\.png|\.jpg|\.js|\.css)+ /site\.$2$3$4 [I,L]
#
#For / on end
RewriteCond Host: (www\.)?(.+)
  RewriteRule (.*)(/$) /site\.$2$3/ [I,L]
#
#Without / on end
RewriteCond Host: (www\.)?(.+)
  RewriteRule (.*) /site\.$2$3/ [I,L]

Back to Top
 
jagdish
Newbie


Joined: 03 October 2007
Location: India
Posts: 23
Posted: 03 October 2007 at 11:48am  

Hi

I am working on similar project where url will be like this

www.newsite.com/viewCategories.asp?idCategory=15

so I am writing in httpd.ini which is placed in the root folder of the project

[ISAPI_Rewrite]

 RewriteEngine on


# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule /httpd(?:\.ini|\.parse\.errors) / [F,I,O]

# Block external access to the Helper ISAPI Extension
RewriteRule .*\.isrwhlp / [F,I,O]

 

#<Directory C:/inetpub/wwwroot/RecruitingApplication/>

#</Directory>


RewriteMap examplemap txt:C:/map.txt

 

#RewriteEngine on
#RewriteBase /

RewriteRule ^RecrutingApplication/([^?/]+)\.asp /RecrutingApplication.asp?EmpId=7?edit=edit

RewriteRule ^RecrutingApplication([^?/]+)\.asp /RecrutingApplication.asp?EmpId=7?edit=edit 

I am writing this just to check if url is getting rewritten and I am getting error 404

please tell me what I am doing wrong

 

thanks in advance

 

Jaggdish

please help me what

 



__________________
Jagdisha
Back to Top
 
Yaroslav
Admin Group


Joined: 15 August 2002
Posts: 6520
Posted: 04 October 2007 at 9:10am  

httpd.ini is a configuration file for ISAPI_Rewrite 2.x Seems like you are trying to use ISAPI_Rewrite 3.0 syntax with version 2.x Install proper ISAPI_Rewrite version and try your rules again.

__________________
Yaroslav Govorunov,
Helicon Tech
Back to Top Visit Yaroslav's Homepage
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum