Support

Admin Tools

#27142 RedirectRule not working

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 Sunday, 19 March 2017 18:17 CDT

JohnB
 Hi Nicholas,

Not really sure if I miss something but after hours puzzling I thought to ask you.

My site uses a component that unfortunately creates double content (if you appoint 2categories to items). SEO doesn't like this so a redirect is needed. Basically the following urls display the same info and there are many more of similar form:

https://www.divemood.com/liveaboards/offers/emperor-serenity-s-best-of-maldives-19-february-2017

https://www.divemood.com/liveaboards/emperor-serenity/emperor-serenity-s-best-of-maldives-19-february-2017

So I thought piece of cake and went into your .htaccess maker and added at the end:

RewriteRule ^/offers/emperor-serenity-(.+)$ /emperor-serenity/emperor-serenity-$1 [R=301,L]

To my knowledge should work, but ... no such luck. Could something be blocking this or am I missing the point.

Sorry, new to regex and trying hard. Any hint appreciated.

John

tampe125
Akeeba Staff
Hello,

please try to change your Rewrite Rule with the following:
RewriteRule /offers/emperor-serenity-(.+)$ /emperor-serenity/emperor-serenity-$1 [R=301,L]

The initial caret (^) means that to match the expression, the string must start with /offers/emperor.., which is not true since you have the liveaboards segment before.

For your information, take a look at this online tester, it is very handy: http://htaccess.mwl.be/

Davide Tampellini

Developer and Support Staff

๐Ÿ‡ฎ๐Ÿ‡นItalian: native ๐Ÿ‡ฌ๐Ÿ‡งEnglish: good โ€ข ๐Ÿ• My time zone is Europe / Rome (UTC +1)
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

JohnB
Ciao Davide,

It works on the site you gave me but then entered the change in .htaccess maker in the box "Custom .htaccess rules at the bottom of the file" and nothing happened. Tried als in the box "Custom .htaccess rules at the top of the file", which caused my error page to appear.
Removed the line, put off cache in global, stopped Gzip compresion, put off compressing in Cpanel . . . but the error remains.

Any hint what could be the problem.

Have about 15 boats on my site, and four additional categories (offers, southern, longer, expert) so need to create 60 lines, but . . . better first get one working well. Not even sure if 301 is the solution or better canonical. Anyway, one thing at the time.

Mille grazie!


tampe125
Akeeba Staff
When you put the rule on the top, can you please attach here the resulting .htaccess? (rename it or it won't be allowed).

Davide Tampellini

Developer and Support Staff

๐Ÿ‡ฎ๐Ÿ‡นItalian: native ๐Ÿ‡ฌ๐Ÿ‡งEnglish: good โ€ข ๐Ÿ• My time zone is Europe / Rome (UTC +1)
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

JohnB
Here it is, simply . . . The one

JohnB
Try Again

tampe125
Akeeba Staff
Ah sorry, the liveaboards part was missing. Please try with this one:
RewriteRule /liveaboards/offers/emperor-serenity-(.+)$ /liveaboards/emperor-serenity/emperor-serenity-$1 [R=301,L]

Davide Tampellini

Developer and Support Staff

๐Ÿ‡ฎ๐Ÿ‡นItalian: native ๐Ÿ‡ฌ๐Ÿ‡งEnglish: good โ€ข ๐Ÿ• My time zone is Europe / Rome (UTC +1)
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

JohnB
Still not . . . but you got me in the right direction, just had to drop the /

RewriteRule liveaboards/offers/emperor-serenity-(.+)$ liveaboards/emperor-serenity/emperor-serenity-$1 [R=301,L]


And . . . it works. Don't know why the / should not be there but, who cares, it works.

Grazie tanto per l'aiuto, sono contento!

Ciao

tampe125
Akeeba Staff
Great!
You're welcome!

Davide Tampellini

Developer and Support Staff

๐Ÿ‡ฎ๐Ÿ‡นItalian: native ๐Ÿ‡ฌ๐Ÿ‡งEnglish: good โ€ข ๐Ÿ• My time zone is Europe / Rome (UTC +1)
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!