Problem adding new rule

ISAPI_Rewrite is a powerful URL manipulation engine based on regular expressions
User avatar
Posts: 16
Joined: 12 Mar 2013, 09:10

Problem adding new rule

30 Apr 2013, 14:52

Hi.

I use these in my code below. htaccess:

Code: Select all
RewriteEngine on
RewriteRule n/(.*),(.*),(.*)--(.*)/ n.asp?c=$1&co=$2&id=$3&t=$4
RewriteRule n/(.*),(.*),(.*)--(.*) n.asp?c=$1&co=$2&id=$3&t=$4

RewriteEngine on
RewriteRule nn/(.*),(.*),(.*)--(.*)/ nn.asp?c=$1&co=$2&id=$3&t=$4
RewriteRule nn/(.*),(.*),(.*)--(.*) nn.asp?c=$1&co=$2&id=$3&t=$4


Was added and it is showing error. There is something wrong under the new rule?

Code: Select all
RewriteEngine on
RewriteRule s/(.*)/ s.asp?s=$1
RewriteRule s/(.*) s.asp?s=$1


Thank you for your attention.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Problem adding new rule

30 Apr 2013, 19:30

Hello,

You do not need "RewriteEngine on" it's from syntax v3.
I would also use '/' in the beginning of the pattern:

Code: Select all
RewriteRule /s/(.*)/ /s.\asp?s=$1


Regards
Andrew

User avatar
Posts: 16
Joined: 12 Mar 2013, 09:10

Re: Problem adding new rule

30 Apr 2013, 19:58

Hi. Thanks for the help but i feel having problems:

The rule:

Code: Select all
RewriteEngine on
RewriteRule n/(.*),(.*),(.*)--(.*)/ n.asp?c=$1&co=$2&id=$3&t=$4
RewriteRule n/(.*),(.*),(.*)--(.*) n.asp?c=$1&co=$2&id=$3&t=$4


Left this link:

http://www.registro.sp.gov.br/n.asp?c=7&co=13&id=18729799&t=EMEF-Olga-Clivatti-Rodrigues-comemora-12-anos-de-atividades

To do this:
http://www.registro.sp.gov.br/n/7,13,18729799--EMEF-Olga-Clivatti-Rodrigues-comemora-12-anos-de-atividades


And now presenting problem. The above rule is not working anymore.

Another issue is that the rule you entered interfered in other site links site. For example, what was "form.asp" was only "form".

I need your rule to work without interfering with each other:

Code: Select all
RewriteRule /s/(.*)/ /s.\asp?s=$1


Can you help me?

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Problem adding new rule

30 Apr 2013, 20:09

I didn't do anything with the rule. You were asking to make it work. I did, but the logic behind it is still the same.
Also, all your previous posts on this forum were about ISAPI_Rewrite 3, now you post in v2. It has different syntax. Please, confirm that you need ISAPI_Rewrite 2, not 3.

Regards
Andrew

User avatar
Posts: 16
Joined: 12 Mar 2013, 09:10

Re: Problem adding new rule

30 Apr 2013, 20:21

Dear friend forgive me for the inconvenience. But according to my hosting there installed version 2 and version 3 together.

I believe sse code below is for version 2 because many years ago that uses it:

Code: Select all
RewriteEngine on
RewriteRule n/(.*),(.*),(.*)--(.*)/ n.asp?c=$1&co=$2&id=$3&t=$4
RewriteRule n/(.*),(.*),(.*)--(.*) n.asp?c=$1&co=$2&id=$3&t=$4


We can do the following if you agree.

You could tell me how the above rule would be in version 3?

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Problem adding new rule

01 May 2013, 00:09

Having both on the server is not a good ides. How would we know which one is actually doing the job.
The difference that we can use now is that ISAPI_Rewrite 2 uses httpd.ini. ISAPI_Rewrite 3 - httpd.conf and .htaccess.

LEts figure out which one you're using and stick to it.

Regards
Andrew

User avatar
Posts: 16
Joined: 12 Mar 2013, 09:10

Re: Problem adding new rule

01 May 2013, 09:52

I use .htaccess

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Problem adding new rule

01 May 2013, 18:03

If it's .htaccess, than it's ISAPI_Rewrite 3.
So lets try to make it nicer and more compact:

Code: Select all
RewriteEngine on
RewriteRule ^n/([^,]*)\,([^,]*)\,([^--]*)--(.*)/?$ /n.asp?c=$1&co=$2&id=$3&t=$4 [NC,L]
RewriteRule ^nn/([^,]*)\,([^,]*)\,([^--]*)--(.*)/?$ /nn.asp?c=$1&co=$2&id=$3&t=$4 [NC,L]
RewriteRule ^s/(.*)/?$ /s.asp?s=$1[NC,L]


Make sure you don't use ISAPI_Rewrite 2.

Regards
Andrew

User avatar
Posts: 16
Joined: 12 Mar 2013, 09:10

Re: Problem adding new rule

01 May 2013, 18:33

Dear Andrew

Thank you for your help. Your code worked perfectly.

I just needed to give a space between between this: $1 (space) [NC, L]

Code: Select all
RewriteRule ^s/(.*)/?$ /s.asp?s=$1 [NC,L]


Thanks!!!

Return to ISAPI_Rewrite 2.x

Who is online

Users browsing this forum: No registered users and 0 guests