How to 301 redirect Joomla htaccess with multiple query parameters

I’ve recently had the opportunity to migrate a Joomla website to WordPress, and it wasn’t a common solution. Please note that this Joomla website contained ugly URLs, not SEO Friendly (SEF) URLs.

An example of an ugly URL is /index.php?option=com_content&view=article&id=91&Itemid=156.

*An ugly URL is also nicknamed as ‘URL containing Query parameters’.

How Joomla works with 301 redirects

Joomla will only allow redirects if the link/page brings up a 404. In that case, it will be simple to redirect. That way, you’ll only have to activate the plugin (not extension) ‘System Redirects’. And apply the redirects to those broken pages.

But let’s say that you want to redirect the entire website — containing working links — to another website? Let’s say that it’s WordPress.

Unfortunately you couldn’t make use of Joomla’s redirects feature. I haven’t found an extension yet that could redirect working Joomla links, but please let me know in the Comments if you do.

I’ve resorted to using the .htaccess file, but then again met another face-off:

You cannot Redirect 301 ‘working Joomla links’ in the .htaccess file.

And this is what the post will be about ^^.

Here’s the code sample to be pasted to the bottom of .htaccess file, repeat as desired (with 1 ReWriteEngine On only):

The .htaccess file reads from bottom to up in some way, and it will override the homepage ^/$ if it finds something more specific to its condition, like if it were on the "/index.php page containing the queries option=com_content&view=article&id=34&Itemid=121".

So place the homepage redirects to the very bottom.

Wrapping Up

The following summary points are:

301 redirects for Ugly URLs must be through 301 Rewrite Rules

‘301 redirects’ are not equal to ‘301 Rewrite Rules’

Place homepage rewrite rules to the very bottom of the snippet

Joomla only redirects broken URLs through its system plugin

Please let me know in the comments below if there are any improvements to this article. I am very open to feedback and since I am not a Joomla Guru I would love to your hear feedback on this.