I am trying to re-write and 301 redirect the URL "www.example.com/index.php?cat=345&art=1234567" to "www.example.com/345/1234567"
Also, I would like to re-write URLs with 3+ parameters, instead of just 2, such as in the URL "www.example.com/index.php?cat=345&art=1234567&artist=45"
I have some code I am using, but it is written for 2 parameters and does not redirect the re-written URL.
Could someone please tell me what I need to change or add to the following code to make it redirect and use more than 2 parameters:
- Code: Select all
# Redirect two-parameter-based index.php¦html? or / URL request
# (with parameters in any order) to folder-based URL format, and
# force www to always be in URL:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(index\.(php¦html?))?(\?[^\ ]*)\ HTTP/ [NC]
RewriteCond %{QUERY_STRING} &?cat=([0-9]{3})&?
RewriteCond %1>%{QUERY_STRING} ^([^>]+)>([^&]*&)*art=([0-9]{7})&?
RewriteRule ^(index\.(php¦html?))?$ http://www.domain.com/%1/%3? [R=301,L]
# Rewrite URL request: www.domain.com/345/1234567 to internal
# path: /index.php?cat=345&art=1234567 to serve content:
RewriteRule ^([0-9]{3})/([0-9]{7})$ /index.php?cat=$1&art=$2 [L]
All help will be greatly appreciated.
Thank you