Forum Moderators: phranque
Please, could you help me with this?
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^det2.php?menu=([^&]+)&cms=([0-9]+)&lan=([0-9]+)$
RewriteRule ^det2.php$ %1-%2-%3.html? [R=301]
RewriteRule ^([^/]+)-([0-9]+)-([0-9]+)\.html$ det2.php?rw=1&name=$1&cms=$2&lan=$3 [QSA]
RewriteCond %{QUERY_STRING} ^det.php?menu=([^&]+)&did=([0-9]+)&lan=([0-9]+)$
RewriteRule ^det.php$ %1-%2-%3.html? [R=301]
RewriteRule ^([A-Za-z][A-Za-z\ -]+)-([0-9]+)-([0-9]+)\.html$ det.php?rw=1&menu=$1&did=$2&lan=$3[QSA]
# Redirect client request for dynamic "det2" URLs to static URL
RewriteCond %{QUERY_STRING} ^menu=([^&]+)&cms=([0-9]+)&lan=([0-9]+)$
RewriteRule ^det2\.php$ http://www.example.com/%1-%2-%3.html? [R=301,L]
#
# Internally rewrite static URL requests to dynamic URL, set "rw=1" to prevent redirect/rewrite looping
RewriteRule ^([^-]+)-([0-9]+)-([0-9]+)\.html$ det2.php?rw=1&name=$1&cms=$2&lan=$3 [QSA,L]
#
# Redirect client request for dynamic "det" URLs to static URL
RewriteCond %{QUERY_STRING} ^menu=([^&]+)&did=([0-9]+)&lan=([0-9]+)$
RewriteRule ^det\.php$ http://www.example.com/%1-%2-%3.html? [R=301,L]
#
# Internally rewrite static URL requests to dynamic URL, set "rw=1" to prevent redirect/rewrite looping
RewriteRule ^([a-z][a-z\ -]+)-([0-9]+)-([0-9]+)\.html$ det.php?rw=1&menu=$1&did=$2&lan=$3 [NC,QSA,L]
%{QUERY_STRING} contains neither any part of the URL-path, nor the "?" that serves as the URL-path/query-string boundary indicator.
Note that the [NC] flag makes the pattern-match case-insensitive, so eliminates the need for [A-Za-z], and is faster.
Jim
Jim