Problem with rewrite inside subfolder
4 posts
• Page 1 of 1
Problem with rewrite inside subfolder
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:
This one is not working, but if I add trailing slash it's working:
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
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
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Problem with rewrite inside subfolder
Hello,
This is strange. Please, use the following rule:
and provide the rewrite.log for the testing request. Logging issues are described in FAQ
Regards
Andrew
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
Re: Problem with rewrite inside subfolder
Sorry for late reply. Rewrite.log below
Everything is ok till line 5 and then some [INTERNAL_REDIRECT] happening :/ How can I track that?
- 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?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Problem with rewrite inside subfolder
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
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
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests