Welcome to WebmasterWorld Guest from 22.214.171.124
How do I get it to allow the variable to be passed on the first four lines of rules?
RewriteRule ^listings/([^/]+)/([^./]+)/?$ /listings.php?city_id=$1&listing_id=$2 [L]
RewriteRule ^listings/([^./]+)/?$ /listings.php?city_id=$1 [L]
RewriteRule ^lots/([^/]+)/([^./]+)/?$ /lots.php?city_id=$1&lot_id=$2 [L]
RewriteRule ^lots/([^./]+)/?$ /lots.php?city_id=$1 [L]
RewriteRule ^subdivisions/([^/]+)/([^./]+)/?$ /subs.php?city_id=$1&sub_id=$2 [L]
RewriteRule ^subdivisions/([^./]+)/?$ /subs.php?city_id=$1 [L]
I have absolutely no problems with something like this:
Being turned into
RewriteRule ^(.*)/(.*)/catid(.*) /script.cgi?STUFF=$1&THING=$2&CAT=$3 [L]
It looks like you may be trying to do a similar thing but are using ([^/]+) instead of (.*).
I do notice you have a . in the last one and not in the first one. ([^/]+) vs ([^./]+) . I believe that "." is "any character", so by leaving it out, you may be breaking your rule. You could also just try:
RewriteRule ^listings/(.*)/(.*)/?$ /listings.php?city_id=$1&listing_id=$2 [L]
I'm no mod_rewrite guru, but I think the above would work. Or maybe it's just the missing ".".
when I go to /listings/city/number the page displays none of the $_GET variables so they are not getting passed as they should be. Same with /lots/city/number, but yet with subdivision/city/number they get passed.
in each file, listings.php, lots.php and subs.php I just have an echo statement to show each of the variables from the query string.
Using a specific pattern like ([^/]+) is much more efficient than using (.*) when more than one sub-pattern is used. (See this post [webmasterworld.com] for details.)
Have you tried requesting any of the URLs that don't work, but with a trailing slash? Does that make any difference?