Forum Moderators: phranque

Message Too Old, No Replies

RewriteCond

         

anjanesh

9:22 am on Aug 4, 2005 (gmt 0)

10+ Year Member



Hi

Im new to mod_rewrite but not new to RegExp. I know to use RegExp in PHP using PCRE.

I have a folder domain.com/a/b
I have the .htaccess in the folder b.


RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com/a/b/ [NC]
ReWriteRule ^list/(.*?)-(.*?)\.htm script\.php?q=$1&start=$2 [L]

Shows 500!

Any idea whats wrong?

Thanks

ChadSEO

4:47 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



anjanesh,

I assume with the (.*?) you are trying to do a non-greedy match, which mod_rewrite does not support (to my knowledge). Also, the HTTP_HOST does not contain any path information; what were you trying to check with that line? If you're just trying to verify the path, then you could do something like this:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/a/b/ [NC]
RewriteRule ^list/([^-]*)-([^\.]*)\.htm script.php?q=$1&start=$2 [L]

jdMorgan

5:25 pm on Aug 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or perhaps:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com [NC]
RewriteRule ^list/([^-]+)-([^\.]+)\.htm script.php?q=$1&start=$2 [L]

if the intent is to verify the requested domain.

Jim

anjanesh

5:36 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



I think I know how to get ReWriteRule working. But its the RewriteCond that I have no idea about.
I just sort of made something out of the RewriteCond that I posted initially.

What I want is
[domain.com...]
to actually execute
[domain.com...]