Search code examples
apache.htaccesshttp-redirecthttp-status-code-301

Redirect / Rewrite with .htaccess of an url containing :


I'm trying to redirect from /index.php?option=com_k2&view=itemlist&task=category&id=44:pinco to google.it

Note the special char :

But it doesn't seem to work.

This is one of the tests I've tried. Where am I wrong?

redirect 301 /?option=com_k2&view=item&id=44:pinco http://www.google.it

Solution

  • You can not redirect Query String using Redirect directive. You need to check Query String using ℅{QUERY_STRING} variable.

    RewriteEngine on
    
    RewriteCond ℅{QUERY_STRING} ^option=com_k2&view=itemlist&task=category&id=44:pinco$
    RewriteRule ^index\.php$ http://google.it? [L,R]