Support

Admin Tools

#36413 Redirect url with match to other url under item id

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by on Friday, 11 February 2022 20:17 CST

gibarra

Hello Guys!

I'm figuring out to redirect url like this:

  • https://www.mydomain.com/component/tags/tag/mytag

to this other one located under a menu id:

  • https://www.mydomain.com/etiquetas/mytag

It's that possible?

Please advice

Gonzalo

nicholas
Akeeba Staff
Manager

You cannot do that with Admin Tools' URL Redirection feature, nor with Joomla's Redirection component since neither supports wildcards. This is something you'd have to do by writing custom .htaccess, web.config or NginX configuration code depending on your server.

The lack for wildcards support was a deliberate choice. Wildcards are powerful and dangerous. It's easy to make a redirection that loops forever using wildcards, rendering your site immediately inaccessible. The worst part for us is that this is such an abstract concept that most people would end up using it to shoot their feet and it'd be really hard to explain to them why they used it wrong. The people who could grasp it and use it without much drama are those who can already do that via other means. Therefore we chose not to provide this feature.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

gibarra

Okey, many thanks for your quick response Nicholas. In my case, one of the reason I would like to do the redirect is we are receiving a good amount of visitor to this "non-canonical" url that are not covered by our template which do the page is broken in those cases so I need to redirect this traffice to the correct url. How can you solve this cases considering the security issue? Which it should be the custom .htaccess mentioned above?

nicholas
Akeeba Staff
Manager

First of all, not seeing the modules in a template is NOT A SECURITY ISSUE. Usability? Yes. Security? Hell no. Not seeing modules doesn't mean you are hacked. Words have meaning and using them outside of that meaning makes it impossible to hold an intelligible conversation.

Now, about the redirection. Off the top of my head:

RewriteRule ^/components/tags/tag/(.*) /etiquetas/$1 [R=permanent,L]

This would need to be added in the custom code to add at the top of the file so it precedes all other rewriting rules. The R=permanent tells Apache 2.4 or later to use a permanent redirection so that search engines don't try to index the URL you don't want to use on your site. If you have an older Apache version replace [R=parmanent,L] with [R,L]. The L flag is important, it tells Apache to stop processing rewrite rules and just do the redirection.

Relevant Apache documentation page: https://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule

 

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

gibarra

Many, many thanks for you respond Nicholas . I will check this code.

All the best

G.

nicholas
Akeeba Staff
Manager

You're welcome!

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

System Task
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!