Not rewriting php files with querystings in subfolder?

Discuss practical ways rearrange URLs using mod_rewrite.

Not rewriting php files with querystings in subfolder?

Postby MikeSwede » Wed Sep 26, 2007 4:02 pm

I have a rewriterule that looks like this:

RewriteRule ^search/([^/]*)/([^/]*)\.html$ /search/widget_sale.php?catid=$1&border=$2 [L]

it rewrites to html files if you have 2 parameters in the querystring. It works fine BUT then I have subfolders like this:
http://www.domain.com/search/alabama/ where I have and index.php file that takes 2 parameters.
My problem is that it seems that my rewriterule also rewrites files in the subfolder but I want to keep them as is.

I tried this:
RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d [NC]
RewriteRule .* - [L]

and it works for not rewriting the folder but like I said, I do not want to rewrite anything in my subfolders.
Is this possible?
MikeSwede
 
Posts: 5
Joined: Sat Jan 27, 2007 8:59 pm

Postby richardk » Thu Sep 27, 2007 3:12 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{REQUEST_URI} ^(/search/[^/]+)(/.*)?$ [NC]
RewriteCond %{DOCUMENT_ROOT}%1 !-d
RewriteRule ^search/([^/]+)/([^/]+)\.html$ /search/widget_sale.php?catid=$1&border=$2 [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Didn't work

Postby MikeSwede » Thu Sep 27, 2007 5:22 pm

Someone said that you could deny rewrite of all index.php pages. I "kind of" tried that but couldn't figure out how. The example I got didn't work.
MikeSwede
 
Posts: 5
Joined: Sat Jan 27, 2007 8:59 pm

Postby richardk » Fri Sep 28, 2007 2:14 pm

What was wrong with what i provided? What didn't it do that you need it to?

Someone said that you could deny rewrite of all index.php pages. I "kind of" tried that but couldn't figure out how. The example I got didn't work.

So you only want to ignore /search/something/index-page? Or all of /search/something? (Which is what my mod_rewrite should do.) What example where you given? What did you try?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 6 guests

cron