Forum Moderators: phranque
RewriteRule ^([^-]+)-([^/]+)/rents-[^-]+-[^/]+/[^-]+-([0-9])-.*\.html page.php?type=$1&loc=$2&nbroom=$3 [QSA,L]
RewriteRule ^(house|appartment|parking)-([^/]+)/rents-[^-]+-[^/]+/[^-]+-([0-9])-.*\.html page.php?type=$1&loc=$2&nbroom=$3 [QSA,L]
RewriteCond %{REQUEST_URI} ^/$1-$2/rents-$1-$2/$1
RewriteRule ^(house|appartment|parking)-([^/]+)/rents-[^-]+-[^/]+/[^-]+-([0-9])-.*\.html page.php?type=$1&loc=$2&nbroom=$3 [QSA,L]
RewriteCond %{REQUEST_URI} ^/(house|appartment|parking)-([^/]+)/
RewriteRule ^%1-%2/rents-%1-%2/%1-([0-9])-%2\.html page.php?type=%1&loc=%2&nbroom=$1 [QSA,L]
RewriteCond %{REQUEST_URI} ^/(house|appartment|parking)-([^/]+)/ # Catch type and locname
RewriteCond $1_$4_$6 ^%1_%1_%1$ # Check property types
RewriteCond $2_$5_$8 ^%2_%2_%2$ # Check locality names
RewriteRule ^([^-]+)-([^/]+)/(rent)-([^-]+)-([^/]+)/([^-]+)-([0-9])-(.+)\.html [...]
input='appartment_appartment' pattern='^$4_$1$' => not-matched
# Rewrite if "A" and "B" are equal in the URL-path /<a>/<b>
RewriteCond $1<>$2 ^(.*)<>\1$
RewriteRule ^([^/]+)/(.+)$ <some-target-path> [L]
RewriteCond %{REQUEST_URI} ^/(house|appartment|parking)-([^/]+)/rents-\1-\2/\1-([0-9])-.*\.html$
RewriteRule .? page.php?type=%1&loc=%2&nbroom=%3 [QSA,L]