Error Handling in CQ5.6.1 - aem

I am working on a CQ 5.6.1 project. I am trying to find how to redirect the 404 error to a custom error page specific to my application. From reading various articles on error handling, I find that the /apps/sling/servlet/errorhandler/404.jsp is the one that handles 404 error. Since there are multiple projects deployed in the CQ, I need to show an error page I create under the project. That is, 404 error from the project1 must be redirected to a custom error page under project1. I was thinking that I should include the redirection code into the /apps/sling/servlet/errorhandler/404.jsp. Is this the right approach or is there a better way to automatically redirect to my projects error page?

This is the right approach. You don't have to create such a custom handler manually - ACS AEM Commons already provides a Error Page Handler supporting many sites.

Related

Unable to read sitemap: Google Search Console

Sitemap could not be read
General HTTP error
1 instance
We encountered an error while trying to access your Sitemap. Please ensure your Sitemap follows our guidelines and can be accessed at the location you provided and then resubmit.
Examples
HTTP Error:500enter image description here
Refer to the posts:
https://www.searchenginejournal.com/gsc-reports-sever-500-errors/375791/#close
https://support.google.com/webmasters/thread/66363365?hl=en
There can be errors in the code of the page or the structure. Google has set certain parameters based on which it decides to validate the submitted URLs and sitemaps.
It will be better if you can share the link of the problematic page so that one can try to catch what might be the issue.
For example:
https://paragpallavsingh.com/sitemap.xml, this is an autogenerated sitemap by WordPress. and submitted in Google search console without any issue.

How to findout more about 404 error from Github pages?

I have created a simple web page on GitHub and here is the url. I am now using fiddler to load it, and every time I load the page, I get a 404 error as well as a successful connection and download of the page, and I do not know why I get the 404 error. When I am logged into GitHub, and click on the clone button of my repo, the url is: https://github.com/InfosecureIT/InfosecureIT.github.io.git
How can I know what file the GitHub server is referring to when it says file can not be found?
# jpvillaisaza - Sure, the error is 404 file not found. is a picture, which would describe the error better.
The error you're getting is related to a missing favicon.ico file. Even though your HTML code doesn't specify a favicon, browsers can request it and display an error. This shouldn't be a problem with loading everything else, but you might want to either add a favicon picture, which will probably be better for your site, or find a way to avoid the favicon request (see How to prevent favicon.ico requests?, for example).

How to intercept error request and redirect to a custom page?

Here is one of the use-case as to what I want to do:
A User clicks on a blog-link or directly pastes the blog-link in the URL
The blog portlet is on the private-page of a Community (Site).
Since the user is not a member of the Community (Site) he would be taken to the error page.
He is shown, either a 404 page or a No-access error page.
My requirement starts: Now instead of showing the above pages or a customized version of the above pages.
I want to Intercept the request for 404 or other such requests.
And redirect to a portal page (not a static error page) based on some parameters of the User and the initial request parameters.
In this case I would want the user to be redirect to any public page of the same Community (Site) and ask him to Join or request membership for that Community (Site).
So in short I would want a way to intercept the request which generates the error and then redirect to where ever I want.
Is this available in liferay? If not can I get some idea as to how can I achieve this?
Environment: Liferay 6.1 GA2
Thanks for your valuable time.
Add a JSP page to manage 404 errors as described here in that Liferay's forum post.
In that JSP you can put your custom logic based on whatever param (the user, the community, etc..) that you can access from inside the JSP using, for example, the themeDisplay object.
An alternative way (and the way I have redirect 404 errors to a specific page in the community) is to override the 404.jsp with a Hook. Then add your custom logic to the overridden JSP.
I'm assuming something similar could be done for no-access.

magento: products not showing up on the frontend : no code

I'm still new to learning Magento. I only followed a tutorial but it's not working. I added a new product and associated it to all categories just as a test. The tutorial would show the image of the product once he clicks on a subcategory but mine didn't.
It gives me this error:
The requested URL /magento/sample-sub-cat-1-tutorials/sample-sub-category-2.html was not found on this server.
What is wrong? I'm doing everything in the admin panel without coding as a start.
That is an error page returned by your web server software, not a Magento-handled 404 page. Try adding index.php before your url string i.e. site.com/index.php/magento/sample-sub-cat-1-tutorials/sample-sub-category-2.html; if that works, you need to check server rewrites (System > Configuration > Web > Search Engines Optimization) or check that rewriting is available for your web server software.

Page renders on browsers but throws "404 page not found" for SEO crawlers and/or requests made by program. What could be the issue?

I built a site out of ZF and installed it fine on my server. I have the MVC structure and use custom routing (for SEO purposes) as below:
mysite.com/controller.html
mysite.com/controller/action.html
Generally, everything is working fine but the only problem is that SE crawlers won't find any .html files. If i open the "Activity" window from Safari, I see all the css and other files being referenced/read fine but not the page itself.
So, the page renders fine on a browser but SE crawlers or any program that made the request won't find the page. I'm wondering if it's an Apache issue. My .htaccess file is the same file that shipped with the ZF.
I really appreciate any advise/suggestions/comments!
Is it possible that your app is serving all pages with a 404 status code? So browsers and crawlers are getting the same thing, but the browser will render the content whereas the crawlers ignore it. I've seen some people use the Error Controller in ZF as a way of doing routing (not a good idea), where the Error Controller 'catches' all requests and then examines the params to determine what to display.
If this isn't your problem please could you edit your question to include:
How it is you know that crawlers are getting a 404
Some more info on how you are doing your routing
Also if you can provide an example URL we can check the headers that are being returned.