• Home
  • Get help
  • Ask a question
Last post 12 min ago
Posts last week 94
Average response time last week 34 min
All time posts 67854
All time tickets 10487
All time avg. posts per day 20

Helpdesk is open from Monday through Friday CET

Please create an (free) account to post any question in the support area.
Please check the development versions area. Look at the changelog, maybe your specific problem has been resolved already!
All tickets are private and they cannot be viewed by anyone. We have made public only a few tickets that we found helpful, after removing private information from them.

#1170 – endless loop of 404 by trying to define an alias for a wrong url pointing to a file

Posted in ‘sh404SEF’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Sunday, 18 October 2015 03:14 UTC
lordhelmchen
 Dear support team,

I really take care of 404 and aliases. If the wrong url points to a website that really works fine. Just adding the alias to the correct url and every call of the wrong url is redirected to the correct one.

But if the url points to a file like png or pdf and I create an alias for the correct url the result is an endless loop of aliases and 404 errors.

Let me try to describe in an example:
the correct url for the file is:
images/audiovero/acourate/acourate.png

the wrong url for the file caused a 404 is
hersteller/images/audiovero/acourate/acourate.png
see alias1.jpg

now I enter the redirect url images/audiovero/acourate/acourate.png and check the result at first in the alias list of sh404sef.
see alias2.jpg

Finally I checked the result by typing in the wrong url
hersteller/images/audiovero/acourate/acourate.png
in chromes url field but it is automatically redirected to
hersteller/images/audiovero/acourate/images/audiovero/acourate/acourate.png
instead of the defined alias
images/audiovero/acourate/acourate.png

of cause that caused a new 404 error.
see alias3.jpg

If I enter the redirect url images/audiovero/acourate/acourate.png again for this second wrong url, two aliases are pointing to the same correct url.
See alias4.jpg

Now I check the result again by typing the first wrong url
hersteller/images/audiovero/acourate/acourate.png
in chromes url field but it is redirected automatically to
http://www.xxxx.net/hersteller/images/audiovero/acourate/images/audiovero/acourate/images/audiovero/acourate/acourate.png
instead of the defined alias
images/audiovero/acourate/acourate.png

of course that caused a 404 again.
see alias5.jpg

In this way I only cause an endless loop of 404 errors and aliases by trying to enter just one redirect url from the wrong url hersteller/images/audiovero/acourate/acourate.png to the right one images/audiovero/acourate/acourate.png.

I have got the same problem for lots of pdf, jpg, png urls, but it takes a while until I noticed that there a allways new 404 for the same file.

I hope that this is not only one of my silly mistakes or that I just ignored a part of the documentation. Really I spent some time to analyze the problem and trying to find a solution, but I am really helpless.

Hoping you can advise how to solve the problem.

Best regards

Markus
Sunday, 18 October 2015 11:30 UTC
lordhelmchen
Dear support team,

I installed a test instance for you:
www.xxxx.net/test

login credentials:
url: www.xxxx.net/test/administrator
user: xxxx
password: xxxx

I purged all sef urls and all aliases to start with a clean database.
The .htacess file only includes the joomla core entries, I attached it to this reply.

you can reproduce the error very easy with the file
correct url: images/xavian/xavian-logo.png
wrong url: hersteller/images/xavian/xavian-logo.png
redirect url: images/xavian/xavian-logo.png
url after entering the wrong url in the url field of chrome: hersteller/images/xavian/images/xavian/xavian-logo.png

Hoping that help to find a solution.

If you need any other information or login credentials, please let me know.

Best regards

Markus
Sunday, 18 October 2015 11:33 UTC
lordhelmchen
ok, I can not attach files with a leading dot, so I renamed .htaccess to dot.htaccess.txt and attached it to this reply...
Monday, 19 October 2015 08:27 UTC
wb_weeblr
Hi

You strictly and absolutely cannot do anything like this. sh404SEF does 301 redirect to existing URLs created by Joomla (as non-sef) and passed to sh404SEF (which stores them in the database).

Creating an alias (as described in the documentation) means that you tell sh404SEF to redirect a request (/som-bad-url.html) to one of the existing SEF URLs in the database (/the-good-one.html).

You can never redirect to an image or a physical pdf file simply because the URLs of those physical files are not in the database. When creating a link to an image or a physical pdf file, Joomla does not "Jroute" it (ie: pass it on to sh404SEF to make it SEF). As those are simple files, they are just linked directly.

Such redirections should be created in your .htaccess, which is by far the fastest and most efficient way to handle this.

Also, as a side note, you also have to look at your 404s and decide if you actually need to redirect them. Many times, just having the 404 is quite good, as it removes bad links from search engines indexes and doesn't use up your crawl budget.

Rgds

 
Monday, 19 October 2015 08:40 UTC
lordhelmchen
Dear support team,

thanks a lot for your reply and your hint using the .htaccess file for such kind of redirects.
My point of view was that the sh404sef engine is responsible for all urls regardless if they are for websites or for files.

Handling file redirects via htaccess is quite comfortable for me, because I can define an easy redirect rule for all the image and file redirects.

Pardon me annoying you with such kind of problems.From your point of view it seems absolute clear and easy, but for grennhorns it is confusing some times.

Best regards

Markus
Monday, 19 October 2015 09:05 UTC
wb_weeblr
Hi

My point of view was that the sh404sef engine is responsible for all urls regardless if they are for websites or for files.
I understand why you would think that, but that's not the case.

sh404SEF is no different from Joomla SEF (it works as a plugin to Joomla SEF) and Joomla SEF doesn't handle images or files either.

It just doesn't make sense to pass files requests through Joomla. The performance loss would be terrible. You probably have more than 20 or 30 requests for images on a single page. Passing images through Joomla would mean to fire the whole Joomla programm 20 or 30 times instead of one.
A file is a file, and you should just link directly to it.

But there's something more important and you did not reply: why do you want to redirect those URLS???

If I talk about "hersteller/images/xavian/xavian-logo.png". I assume this is an old URL for your logo? where is it linked from? what's the reason to redirect it?

Rgds
 
Monday, 19 October 2015 18:22 UTC
lordhelmchen
Dear suport team,

thanks for your detailed information. I understand your extension better and better.

Formerly the images were stored anywhere on the server and the whole structure of the site was a real mess. After we decided to manage our website on our own, we stored all images in the /image folder among other reorganisations.

So if we see old file links in sh404sef 404 error list, we can redirect them to the new location.

Best regards

Markus


Monday, 19 October 2015 18:25 UTC
wb_weeblr
Hi

Actually, if the old link is on your site (in an article for instance), what you really must do is fix the article link. It's not very good to have redirects, you loose some SEO value there. It's much better to fix the link. Of course, it the link is on somebody else site, you cannot do anything, but if it's on your site, you should fix the link rather than redirect.

Rgds
 
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.