0

Having a bit of a problem and wondering what I've done wrong.

Options -Multiviews

RewriteEngine On
RewriteBase /

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.rentus.com/$1 [R=301,L]

RewriteRule ^([a-z]+)\/?$ $1.php [NC]
RewriteRule ^([-a-z]+)\/([-a-z]+)/?$ category.php?param=$1&param2=$2 [L,QSA]
RewriteRule ^([-a-z]+)\/([-a-z]+)/?$ city.php?param=$1&param2=$2 [L,QSA]

So it works with general pages like "/about/" and then category.php with query strings on category.php "/category/hats/".

When I try to load "/city/losangeles/" Its loading category.php file instead of city.php file. Any idea what I can do to make this work properly and use the php file I tell it too?

ValhallaSkies
  • 61
  • 1
  • 12
  • A [simple front controller](https://stackoverflow.com/questions/6890200/what-is-a-front-controller-and-how-is-it-implemented-in-php) would make that much easier. Much, much easier. – Jared Farrish Jun 17 '17 at 23:00

1 Answers1

0

Your rules are the exact same, so it wont ever reach the second:

RewriteRule ^([-a-z]+)\/([-a-z]+)/?$ category.php?param=$1&param2=$2 [L,QSA]
RewriteRule ^([-a-z]+)\/([-a-z]+)/?$ city.php?param=$1&param2=$2 [L,QSA]

Try this (Be aware, your param will no longer contain category/city, and will now include the actual category or city):

RewriteRule ^category\/([-a-z]+)/?$ category.php?param=$1 [L,QSA]
RewriteRule ^city\/([-a-z]+)/?$ city.php?param=$1 [L,QSA]
Blue
  • 22,608
  • 7
  • 62
  • 92