i have a rental property website and i am migrating to a new site. i have problem with my rules from apache.
eg: /FL/Miami/2/ /CA/San-Diego/41/
i want to be able to display dynamically a page based on the url
rewriterule ^([a-z]+)/$ index.php?state=$1&city=&mode=list
rewriterule ^([a-z]+)/([a-z]+)/$ index.php?state=$1&city=$2&mode=list
rewriterule ^([a-z]+)/([a-z]+)/([0-9]+)/$ index.php?state=$1&city=$2&id=$3
so i see all the list for each state or list for each state/city
now my problem is when i try to see page 2, i get the ID instead
is there a magic way to fix this?
Here's what will work for you (put this in your .htaccess in your document root):
RewriteEngine On
RewriteBase /
rewriterule ^([a-z]+)/?$ index.php?state=$1&city=&mode=list [NC,L,QSA]
rewriterule ^([a-z]+)/([a-z0-9_\-]+)/?$ index.php?state=$1&city=$2&mode=list [NC,L,QSA]
rewriterule ^([a-z]+)/([a-z0-9_\-]+)/([0-9]+)/?$ index.php?state=$1&city=$2&pagenum=$3&mode=page [NC,L,QSA]
rewriterule ^([a-z]+)/([a-z0-9_\-]+)/([0-9]+)/([a-z0-9_\-]+)/?$ index.php?state=$1&city=$2&id=$3&mode=view [NC,L,QSA]
So:
/california/san-diego/2
or /california/san-diego/2/
will to go page 2
/FL/Miami/2/home-house-test
or /FL/Miami/2/home-house-test/
will to to the property page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With