Problem with rewrite inside subfolder

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 18 Jan 2013, 13:02

Problem with rewrite inside subfolder

18 Jan 2013, 13:33

Hi

I have following problem with mod rewrite.

My site has a subfolder (my-folder), so "www.my-site.com/my-folder" and "www.my-site.com/my-folder/" pointing to index.php in this folder (server configuration), but everything after that is ignored.

I want to rewrite urls like "www.my-site.com/my-folder/some-category" to index.php?param=$1 where $1 should be "some-category"

My current .htaccess inside this folder:

Code: Select all
RewriteEngine On

RewriteRule (.+) index.php?param=$1 [L]


This one is not working, but if I add trailing slash it's working:

Code: Select all
RewriteEngine On

RewriteRule (.+)/ index.php?param=$1 [L]


The problem is that I don't want trailing slash because of the SEO (previous structure used wordpress schema without trailing slashes).

Currently everything that comes into this folder is redirected as index.php?param=index.php :/

How do I configure it?

Thanks,
Matt

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

Re: Problem with rewrite inside subfolder

20 Jan 2013, 17:45

Hello,

This is strange. Please, use the following rule:

Code: Select all
RewriteEngine On

RewriteRule (.+) index.php?param=$1 [L]


and provide the rewrite.log for the testing request. Logging issues are described in FAQ

Regards
Andrew

User avatar
Posts: 2
Joined: 18 Jan 2013, 13:02

Re: Problem with rewrite inside subfolder

25 Jan 2013, 06:30

Sorry for late reply. Rewrite.log below

Code: Select all
xx.xxx.77.55 xx.192.77.xx  [25/Jan/2013:09:01:08] [www.mywebsite.com/sid#2][rid#5825826/initial] (1) [perdir d:\websites\mywebsiteDIR\my-subfolder\] init rewrite engine with /my-subfolder/my-param-i-want
xx.xxx.77.55 xx.192.77.xx   [25/Jan/2013:09:01:08] [www.mywebsite.com/sid#2][rid#5825826/initial] (5) [perdir d:\websites\mywebsiteDIR\my-subfolder\] strip matching prefix: /my-subfolder/my-param-i-want -> my-param-i-want
xx.xxx.77.55 xx.192.77.xx   [25/Jan/2013:09:01:08] [www.mywebsite.com/sid#2][rid#5825826/initial] (3) [perdir d:\websites\mywebsiteDIR\my-subfolder\] applying pattern (.+) to uri my-param-i-want
xx.xxx.77.55 xx.192.77.xx   [25/Jan/2013:09:01:08] [www.mywebsite.com/sid#2][rid#5825826/initial] (5) [perdir d:\websites\mywebsiteDIR\my-subfolder\] add per-dir prefix: index.php?agent=my-param-i-want -> /my-subfolder/index.php?agent=my-param-i-want
xx.xxx.77.55 xx.192.77.xx   [25/Jan/2013:09:01:08] [www.mywebsite.com/sid#2][rid#5825826/initial] (1) [perdir d:\websites\mywebsiteDIR\my-subfolder\] Rewrite URL to >> /my-subfolder/index.php?agent=my-param-i-want [REWRITE]
xx.xxx.77.55 xx.192.77.xx   [25/Jan/2013:09:01:08] [www.mywebsite.com/sid#2][rid#5825826/initial] (1) [perdir d:\websites\mywebsiteDIR\my-subfolder\] Rewrite URL /my-subfolder/my-param-i-want to >> /my-subfolder/index.php [INTERNAL_REDIRECT]
xx.xxx.77.55 xx.192.77.xx   [25/Jan/2013:09:01:08] [www.mywebsite.com/sid#2][rid#42873357/initial/1] (5) [perdir d:\websites\mywebsiteDIR\my-subfolder\] strip matching prefix: /my-subfolder/index.php -> index.php
xx.xxx.77.55 xx.192.77.xx   [25/Jan/2013:09:01:08] [www.mywebsite.com/sid#2][rid#42873357/initial/1] (3) [perdir d:\websites\mywebsiteDIR\my-subfolder\] applying pattern (.+) to uri index.php
xx.xxx.77.55 xx.192.77.xx   [25/Jan/2013:09:01:08] [www.mywebsite.com/sid#2][rid#42873357/initial/1] (5) [perdir d:\websites\mywebsiteDIR\my-subfolder\] add per-dir prefix: index.php?agent=index.php -> /my-subfolder/index.php?agent=index.php
xx.xxx.77.55 xx.192.77.xx   [25/Jan/2013:09:01:08] [www.mywebsite.com/sid#2][rid#42873357/initial/1] (1) [perdir d:\websites\mywebsiteDIR\my-subfolder\] Rewrite URL to >> /my-subfolder/index.php?agent=index.php [REWRITE]


Everything is ok till line 5 and then some [INTERNAL_REDIRECT] happening :/ How can I track that?

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

Re: Problem with rewrite inside subfolder

25 Jan 2013, 09:56

Hello,

internal redirect is good. It simply shows that the rule has taken place. The strange thing is that apter the rule has been executed, index.php is processed again. It should have stopped after internal redirect. Please, check if you have double registration, this can be a problem.

What build is it?(see ISAPI_Rewrite Manager) Can you provide the log for the same rule, but with '/'? You said it is working with '/' at the end.

regards
Andrew

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 0 guests