views:

65

answers:

2

I have the following rules in my htaccess:

RewriteRule ^([^/.]+)/?$ list.php?categoryShortForm=$1&locationShortForm=world   [QSA]
RewriteRule ^([^/.]+)/([^/.]+)/?$ list.php?categoryShortForm=$1&locationShortForm=$2    [QSA]
RewriteRule ^([^/.]+)/([^/.]+)/[^/.]*-p([0-9]+)/?$ view.php?categoryShortForm=$1&locationShortForm=$2&postingId=$3  [QSA]

In my localhost (windows, xampp), it all works fine. In my real server (linux, apache) the first 2 rules work fine, but not there 3rd one.

For example:

/plastic-surgery/california-usa/ works fine, but /plastic-surgery/los-angeles-california-usa/test-1-p1 gives me a 404

Any idea??

+1  A: 

Check to make sure that you can browse directly to the target URLs. If mod_rewrite is rewriting onto something that doesn't exist, you'll get that 404. It might help to ratchet up mod_rewrite's log level to a high value, so you can see what it's rewriting to.

skaffman
*me * stupid *! I didn't upload the target file view.php. Thanks!
nute
A: 

I am a little unclear on how your working URL is supposed to actually work. All three of your patterns start with "one or more non-slash, non-period characters" ([^/.]+), but URLs going into the pattern matching start with slashes: "/plastic-surgery/california-usa/".

Have you turned on mod_rewrite logging and checked out what mod_rewrite is actually doing?

  RewriteLog "/tmp/rewrite.log"
  RewriteLogLevel 9
Tommy McGuire