tester test probar online mod_rewrite htaccess debugger regex .htaccess mod-rewrite

test - Reemplazar "index.php? Option=com_k2 & view=item & id=" utilizando.htaccess y Regex



probar htaccess (2)

No puede capturar cadena de consulta en RewriteRule . Use una RewriteCond en RewriteCond lugar. Usa esta regla en la parte superior de tu .htaccess:

RewriteCond %{THE_REQUEST} /index/.php/?option=com_k2&view=item&id=([^/s&]+) [NC] RewriteRule ^ https://www.portal-gestao.com/artigos/%1? [L,R=302]

¿Cómo reemplazo?

https://www.example.com/index.php?option=com_k2&view=item&id=7377

Por:

https://www.portal-gestao.com/artigos/7377

Intenté esto:

RewriteRule ^index.php?option=com_k2&view=item&id=(.*)$ /artigos/$1 [R=301,L]

Y esto:

RewriteRule ^index.php?option=com_k2&view=item&id=//([0-9]{4}-.*)$ /artigos/$1 [NC,R,L]


También puede hacer esto con el código de coincidencia RewriteCond Query String:

# Individual explicit redirect rules based on exact matching URI|Query String parameters # $1? Strip the option=com_k2&view=item&id=7377 Query String from the destination URI RewriteCond %{QUERY_STRING} ^option=com_k2&view=item&id=7377$ [NC] RewriteRule ^(.*)$ /artigos/7377/$1? [R=301,L] RewriteCond %{QUERY_STRING} ^option=com_k2&view=item&id=7378$ [NC] RewriteRule ^(.*)$ /artigos/7378/$1? [R=301,L] # Dynamically redirect all matching Query Strings to equivalent URI # %2 match and redirect to equivalent 4 digit number URI # $1? Strip the option=com_k2&view=item&id= portion of the Query String from the destination URI RewriteCond %{QUERY_STRING} ^(option=com_k2&view=item&id+)=([0-9]{4}+)$ [NC] RewriteRule ^(.*)$ /artigos/%2/$1? [R=301,L]