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
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Some help: htaccess to httpd.ini Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
angelwebster
Newbie
Newbie


Joined: 19 August 2011
Online Status: Offline
Posts: 4
Posted: 19 August 2011 at 1:24am | IP Logged Quote angelwebster

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 View angelwebster's Profile Search for other posts by angelwebster
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 19 August 2011 at 7:13am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
angelwebster
Newbie
Newbie


Joined: 19 August 2011
Online Status: Offline
Posts: 4
Posted: 19 August 2011 at 9:17am | IP Logged Quote angelwebster

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 View angelwebster's Profile Search for other posts by angelwebster
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 19 August 2011 at 9:44am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
angelwebster
Newbie
Newbie


Joined: 19 August 2011
Online Status: Offline
Posts: 4
Posted: 19 August 2011 at 9:58am | IP Logged Quote angelwebster

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 View angelwebster's Profile Search for other posts by angelwebster
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 22 August 2011 at 5:32am | IP Logged Quote Anton

Ok, please try it like this:

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

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
angelwebster
Newbie
Newbie


Joined: 19 August 2011
Online Status: Offline
Posts: 4
Posted: 22 August 2011 at 9:24am | IP Logged Quote angelwebster

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 View angelwebster's Profile Search for other posts by angelwebster
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
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