This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Some help: htaccess to httpd.ini
Author
Message |
angelwebster
Newbie


Joined: 19 August 2011
Posts: 4
Posted: 19 August 2011 at 1:24am

I'm tranferring a website to an IIS based hosting party with V2.x Asapi enabled, but I am having trouble translating the rewriting rules from the htacces file to de httpd.ini

 

Can someone please help?

 

Basicly what I am trying to do is:

 

Exclude existing directories

Exclude existing files

All other url's should be redirected to /site.php?url=$1

 

The latter should translate like:

 

http://www.mydomain.com/en/for-sale/ to

 

http://www.mydomain.com/site.php?url=en/for-sale/

 

This is the current htacces file:

 

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) /site.php?url=$1 [QSA,L]

 

I have been trying several things based on the forum, seem to mix up the syntax.

Thanks!

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 19 August 2011 at 7:13am

It's not going to be very convenient on v2, but here's the best we can get:

[ISAPI_Rewrite]
RewriteRule /(?!(?:put|all|physical|files|and|folders|here))(.*) /site.php\?url=$1 [I,L]

It would be much easier for you to use ISAPI_Rewrite 3, so please consider it for the future. In such case you could use the config as is.

__________________
Regards,
Anton
Back to Top
 
angelwebster
Newbie


Joined: 19 August 2011
Posts: 4
Posted: 19 August 2011 at 9:17am

Many thanks for the reply!

Not very convenient indeed. Could you help me with the code if rewriting is based on the second part of the url? Thus not excluding existing directories and files, but defining when to rewrite.

Meaning in this url: http://www.mydomain.com/en/for-sale/alfaromeo-gti/

the /for-sale/ part,. That could be limited to approx. 8 variations, like sold, projects, restaurations.Would that be like:

RewriteRule /(?for-sale.*)/([^.]+) /site.php\?url=$1 [I,L]

for each variant?

Your help is most apreciated!

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 19 August 2011 at 9:44am

It will be like this if you want to whole URL in the url parameter (/en/for-sale/alfaromeo-gti/)

RewriteRule (/en/for-sale/[^.]+) /site.php\?url=$1 [I,L]

or
like this if you want to only a part after for-sale in url parameter (alfaromeo-gti/):

RewriteRule /en/for-sale/([^.]+) /site.php\?url=$1 [I,L]

__________________
Regards,
Anton
Back to Top
 
angelwebster
Newbie


Joined: 19 August 2011
Posts: 4
Posted: 19 August 2011 at 9:58am

Ok! then please 2 more questions:

I would like the url parameter to be (en/for-sale/alfaromeo-gti/), without the first / if possible.

Second: In this rule

RewriteRule (/en/for-sale/[^.]+) /site.php\?url=$1 [I,L]

you also included the /en/ part. (It signifies the different languages on the site and increase the numer of rules) Can this part be left out?

Like

RewriteRule (*anythingbefore*/for-sale/[^.]+) /site.php\?url=$1 [I,L]

Thanks again!

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 22 August 2011 at 5:32am

Ok, please try it like this:

RewriteRule .*/(for-sale/[^.]+) /site.php\?url=$1 [I,L]

__________________
Regards,
Anton
Back to Top
 
angelwebster
Newbie


Joined: 19 August 2011
Posts: 4
Posted: 22 August 2011 at 9:24am

Hi Anton,

Thx very much on the rewrite rules, but in the end its not
working for my site. I need the exclusion of the existing
files and directories in combination with the rewrite
rules.
As you mentioned before it is a cumbersome task to list al
of them.

I've asked the hosting company for 3.x
Anyway, glad with your support!
Back to Top
 

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