Hello, i need help with this 2 rewrite rules:
RewriteEngine On
RewriteBase /
# folder/script.php?A=1&B=2 -> xyz/1/2 (REDIRECT)
RewriteCond %{QUERY_STRING} ^A=([^&]+)&B=([^&]+)$
RewriteRule ^folder\/script\.php$ /xyz/%1/%2? [R=301,L]
# xyz/1/2 -> folder/script.php?A=1&B=2 (REWRITE)
RewriteRule ^xyz\/([^\/]+)\/([^\/]+)$ /folder/script.php?A=$1&B=$2 [L]
First I need "REDIRECT"
FROM: efectorelativo.net/folder/script.php?A=1&B=2
TO: efectorelativo.net/xyz/1/2Then i need "REWRITE" not "REDIRECT"
FROM: efectorelativo.net/xyz/1/2
TO: efectorelativo.net/folder/script.php?A=1&B=2
EDIT: (working code, thanks to Gumbo)
RewriteEngine On
RewriteBase /
# folder/script.php?A=1&B=2 -> xyz/1/2 (REDIRECT)
RewriteCond %{THE_REQUEST} \?A=([^&]+)&B=([^\s&]+)
RewriteRule ^folder\/script\.php$ /xyz/%1/%2? [R=301,L]
# xyz/1/2 -> folder/script.php?A=1&B=2 (REWRITE)
RewriteRule ^xyz\/([^\/]+)\/([^\/]+)$ /folder/script.php?A=$1&B=$2 [L]