Redirects for Joomla Experimental URL Routing


Htaccess redirectsAlthough I found a posted solution a few months ago for URLs with article ID only (, I had several different scenarios that were going to 404’s.  Those were:



Links with category ID


Links with regular, non ID numbers in alias


Below is the condensed code that accounts for all vaiants. 

RewriteCond %{REQUEST_URI} (.*)\/(\d{1,}-|)(.*)\/(\d{1,}-|)(.*)
RewriteRule ^(.*)(\/)(.*) %1/%3/%5 [L,QSA,R=301]


You can test specific URLs against it using


Below are the rules broken out separately in case anyone needs to customize.   When I get some more time, I will write explanations.  If you find a link that does not properly redirect, please add it to the comments as I want to improve it.


### with CATEGORY ID and ARTICLE ID ###
RewriteCond %{REQUEST_URI} (.*)(\/)(\d{1,})(-)(.*)(\/)(\d{1,})(-)(.*)
RewriteRule ^(.*)(\/)(.*) %1/%5/%9 [L,QSA,R=301]

### with CATEGORY ID only ###
RewriteCond %{REQUEST_URI} (.*)(\/)(\d{1,})(-)(.*)(\/)(.*)
RewriteRule ^(.*)(\/)(.*)(\/)(.*) %1/%5/%7 [L,QSA,R=301]

### ARTICLE ID only ###
RewriteCond %{REQUEST_URI} ^(.*)/(\d+)-([^/]+)$
RewriteRule ^ %1/%3 [L,QSA,R=301]


Also, for working on code like this, online testers are invaluable since there is a lot of trial and error.

Regex Tester

.htaccess Test


Thanks to Andreas Karr for taking my rules and consolidating into one awesome rule.  This is another good reference for regex.

About YellowWebMonkey

YellowWebMonkey Web design offers reliable website design, SEO and digital marketing services for Joomla, WordPress and Shopify sites. We strive to be a one-stop shop for all your web needs.

Recent Posts

Follow Us