Support

Admin Tools

#28373 .htacces RewriteRule acting strange

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 Wednesday, 04 October 2017 17:17 CDT

JohnB
Hi Nicholas,or other clever people!

Doubt if this is caused by Admin Tools, but as going around in circles and within your expertise hope I don't offend you by asking. I run a booking site for divetrips in Maldives and have now about 20 boats on my site

For a boattrip (in this example for a trip of a boat called Adora) the following URLs lead to the same content:
https://www.divemood.com/liveaboards/adora/adora-s-best-of-maldives-10-september-2017
https://www.divemood.com/liveaboards/offers/adora-s-best-of-maldives-10-september-2017
https://www.divemood.com/liveaboards/longer-trips/adora-s-best-of-maldives-10-september-2017
https://www.divemood.com/liveaboards/southern-trips/adora-s-best-of-maldives-10-september-2017
https://www.divemood.com/liveaboards/expert-trips/adora-s-best-of-maldives-10-september-2017

That's not good and I don't want so . . .

Created a RewriteRule in .htaccess solved this:
RewriteRule liveaboards/offers/adora-(.+)$ liveaboards/adora/adora-$1 [R=301,L]
RewriteRule liveaboards/longer-trips/adora-(.+)$ liveaboards/adora/adora-$1 [R=301,L]
RewriteRule liveaboards/southern-trips/adora-(.+)$ liveaboards/adora/adora-$1 [R=301,L]
RewriteRule liveaboards/expert-trips/adora-(.+)$ liveaboards/adora/adora-$1 [R=301,L]

(Writing this I suspect this might be done in one single line maybe:
RewriteRule liveaboards/(.+)/adora-(.+)$ liveaboards/adora/adora-$2 [R=301,L]
I should test that, great!)

Just added 4 languages and now all these URLs are also created with /nl /de /it or /ru just after the root domain, for example:
https://www.divemood.com/it/liveaboards/adora/adora-s-best-of-maldives-10-september-2017
https://www.divemood.com/it/liveaboards/offers/adora-s-best-of-maldives-10-september-2017
(I guess enough to understand)

Testing the rule for these URLs (http://htaccess.mwl.be/) gives perfect redirection to:
https://www.divemood.com/it/liveaboards/adora/adora-s-best-of-maldives-10-september-2017

But on my site they always go back to the default language:
https://www.divemood.com/liveaboards/adora/adora-s-best-of-maldives-10-september-2017

Going around in circles what could cause this . . . any hint or help appreciated.

Thanks in advance even for just reading it . . .

Greetings from Maldives!

John

JohnB
As I cannot give up finding what is the issue, thought should mention that:

RewriteRule liveaboards/(.+)/adora-(.+)$ liveaboards/adora/adora-$2 [R=301,L]

works perfectly on a .htaccess test page, but . . . not on my site. Just to mention as there must be something conflicting with the proper URL creation. But . . . what?

nicholas
Akeeba Staff
Manager
When you redirect to a page that does not have the language code the default Joomla! behavior is to use the default language of your site. I guess you could write a better redirection rule or, simpler, a redirection rule per language. Well, this is not related to Admin Tools and it's a super busy week for me so I'm afraid I can't really help much :(

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!