Forum Moderators: phranque
RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d [NC]
RewriteRule .* - [L]
RewriteRule ^search/([^/]*)/([^/]*)\.html$ /src/index.php?cid=$1&br=$2 [L]
What is does is to rewrite a file to a virtual folder like this:
www.example.com/src/2/a.html which is fine and dandy.
Now to my problem.
I have a "real" subfolder that I don't want to be re-written so that why I added the request-filename and that works fine to BUT if I have a file in the "real" folder with querystring i chokes and I don't know how to get it right.
this works:
http://www.example.com/srch/utah/
this does not work:
http://www.example.com/srch/utah/index.php?cat=1&dat=2
I need the last one to stay the same, not to be re-written...
Is it even possible?
[edited by: jdMorgan at 1:24 am (utc) on Sep. 26, 2007]
[edit reason] example.com [/edit]
But partly as a test, and partly as a major efficiency improvement, have you tried a simpler approach like:
RewriteCond %{REQUEST_URI} !^/src/index\.php$
RewriteCond %{REQUEST_URI} !^/srch/
RewriteCond %{REQUEST_URI} !^/robots\.txt$
RewriteRule ^search/([^/]*)/([^/]*)\.html$ /src/index.php?cid=$1&br=$2 [L]
This approach has the advantage that it does not force two extra searches of your filesystem for each and every HTTP request -- checks that can quickly bog down a busy server... It also has the advantage of being quite explicit about what is and is not to be rewritten.
Jim
[edited by: jdMorgan at 1:23 am (utc) on Sep. 26, 2007]
RewriteCond %{REQUEST_URI} !/index\.php$
RewriteCond %{REQUEST_URI} !^/robots\.txt$
RewriteRule ^search/([^/]*)/([^/]*)\.html$ /src/index.php?cid=$1&br=$2 [L]
Jim
[edited by: jdMorgan at 2:24 am (utc) on Sep. 26, 2007]
Seems like it doesn't care about the index.php part....
[domain.com...]
Please remember that we cannot look over your shoulder, so we do not know what you expect to happen in this case or in other cases. When you post about a test, please let us know what URL-path you requested, what you expected to happen, what the actual results were, and how the actual results differed from your expectations. Doing this every time makes collaborative debugging much more efficient and faster.
Jim
If I say that this is the only thing I want rewritten and nothing else:
RewriteRule ^search/([^/]*)/([^/]*)\.html$ /src/index.php?cid=$1&br=$2 [L]
What can you do to stop it from rewriting anything I have in subfolders to domain.com/search/?