In J3 i used specific rewrite rules in .htaccess
that worked fine but doesn't seem to work in J4. Here's an example :
RewriteRule ^metier/([a-zA-Z0-9-_]+)\.html$ /index.php?option=com_content&view=article&id=18&Itemid=102&filtrefonction=$1 [QSA,L]
In J4, when I use this URL in my browser it works fine :
/index.php?option=com_content&view=article&id=18&Itemid=102&filtrefonction=$1
but when I try the rewritten URL :
/metier/btp-construction.html
I get a 404 error Page not found... RewriteEngine
is On
of course and the rules in the .htaccess
file.
I have tried to change the rule this way :
RewriteRule ^metier-([a-zA-Z0-9-_]+)\.html$ /index.php?option=com_content&view=article&id=18&Itemid=102&filtrefonction=$1 [QSA,L]
and try to call the url
/metier-btp-construction-usines-infrastructures-tp.html
but it gives the same result : an error 404 :/
Does anyone have any idea about this issue? Thanks for any answer!
/index.php?option=com_content&view=article&id=18&Itemid=102&filtrefonction=$1
" - Presumably you replaced$1
withbtp-construction
(in your example)? Where exactly have you put this rule in the.htaccess
file? A rule like this would need to go near the top of the.htaccess
file, before the Joomla code block (front-controller pattern).[a-zA-Z0-9-_]
) is a little ambiguous (although should be OK in this case as it happens) since you have an unescaped literal hyphen that is not the first or last character. It would be "safer" to move the literal hyphen to the last position (switching the last two characters), ie.[a-zA-Z0-9_-]