Search code examples
.htaccessjoomla

htaccess 301 redirect joomla URLs with multiple variables


I'm trying to redirect this URL:

https://www.sendmoneypacific.org/index.php?option=com_countries&view=details&Itemid=165&lang=en

to this URL:

https://www.sendmoneypacific.org/pacific-communities/solomon-islands.html

I've tried the following:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^option=com_countries&view=details&Itemid=165&lang=en$
RewriteRule ^/index.php$ https://www.sendmoneypacific.org/pacific-communities/solomon-islands.html? [R=301,L]

and:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/index.php$
RewriteCond %{QUERY_STRING} ^option=com_countries&view=details&Itemid=165&lang=en$
RewriteRule ^(.*)$ https://www.sendmoneypacific.org/pacific-communities/solomon-islands.html? [R=301,L]

But neither work. Any help would be greatly appreciated!


Solution

  • I figured it out -

    ## https://www.sendmoneypacific.org/index.php?option=com_countries&view=details&Itemid=165&lang=en
    RewriteCond %{QUERY_STRING} ^option\=com_countries&view\=details&Itemid\=165&lang\=en$
    RewriteRule ^index\.php$ https://www.sendmoneypacific.org/pacific-communities/solomon-islands.html? [R=301,L]
    

    If anyone else needs help with this