Support

Admin Tools

#22060 URL Redirection for 404 to 301

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, 13 March 2015 18:20 CDT

quebecguitare
 Hello, I had these conflicts in K2 for items with SEF activated that have the same titles.

I decided to include the K2 Item ID in the URL but now the old url returns 404.

Here is the URL architecture before and after:

EXAMPLE 1:
Before:
http://www.quebecguitare.ca/suivi/guylaine/cours-de-guitare-classique-de-martin-b-quebec

After (same K2 item):
http://www.quebecguitare.ca/suivi/guylaine/1284-cours-de-guitare-classique-de-martin-b-quebec

EXAMPLE 2:
Before:
http://www.quebecguitare.ca/suivi/guylaine/cours-de-guitare-classique-de-martin-b-quebec

After (same K2 item):
http://www.quebecguitare.ca/suivi/guylaine/1250-cours-de-guitare-classique-de-martin-b-quebec


-I doubt there is a way to detect the right K2 Item for a 404 and make a 301 as there will be multiple cases with just the ID that differs (see the above example 1,2).

That being said, I would like to redirect, for a lack of better solution, the 404 that are only under the directory /suivi/subdirectory/bad_404 to /suivi/ root, which is the main category page for these subcategories items items.

Could you instruct on how to perform this in your tool or give the proper redirect rule in htaccess?

Thank you for your time,
Much Appreciated!
Regards
Alex.

tampe125
Akeeba Staff
Hello Alexandre,

please try adding the following rule:
RewriteRule ^/suivi/subdirectory/(.*)$ /suivi/$1 [R=301,NC,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!

quebecguitare
It didn't work. I tested it with this tools along with the admintools .htaccess editor.

http://htaccess.madewithlove.be/

The /subdirectory/ part will also need to be a variable.

Edit: URL needs to be redirected only if it returns a 404.


Regards

tampe125
Akeeba Staff
There are too many "moving parts": sadly you can only track down every URL that is throwing a 404 error (you can use Google Webmaster Tools) and manually add the URL inside the URL Redirection page

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!

quebecguitare
But your redirect didn't even work for one url, did I miss something?

-I could write all the subdirectory part there are just 6 of them. So only one moving part would be involved.

This did not work:

http://www.quebecguitare.ca/suivi/guylaine/cours-de-guitare-classique-de-martin-b-quebec

RewriteRule ^/suivi/guylaine/(.*)$ /suivi/$1 [R=301,NC,L]

How to have it return: http://www.quebecguitare.ca/suivi/

OR

http://www.quebecguitare.ca/suivi/guylaine/


?

thank you
Regards.

tampe125
Akeeba Staff
If you simply want to redirect the URL to the "parent" subdirectory, you can use this one:
RewriteRule ^/suivi/subdirectory/(.*)$ /suivi [R=301,NC,L]

It will redirect every URL contained in the subdirectory to the parent one.

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!

quebecguitare
It doesn't work both with these two:

RewriteRule ^/suivi/subdirectory/(.*)$ /suivi [R=301,NC,L]
RewriteRule ^/suivi/guylaine/(.*)$ /suivi [R=301,NC,L]

for this URL: http://www.quebecguitare.ca/suivi/guylaine/cours-de-guitare-classique-de-martin-b-quebec

Using the test tool and adding it to the admintools htaccess tool.

Am I missing out on anything?

Caching is off.
CDN is off
Tried on 2 browser
Clearned cache.

This is my htaccess file in attachment.

Thank you
Regards

tampe125
Akeeba Staff
I'm sorry but your question is not directly related to our software: I can give you only general direction on how and where put the custom htaccess rule.
I tried to give you some advice, but your problem is quite tricky and I can't provide further support as per our Terms of Service.

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!