- This topic has 9 replies, 2 voices, and was last updated 8 years, 11 months ago by Mahesh.
-
AuthorPosts
-
January 18, 2016 at 10:42 pm #83158LarsParticipant
Hi
I would appreciate some assistance on the following (Using Catch Flames Pro):Is it possible (and how) to return the 404.php (including the proper html 404 response for search engines) for post-/author-/archive not found instead of the default theme text, similar to “pages not found” ? Url: http://energyfaculty.com (example: energy faculty.com/author and energy faculty.com/author/user)
I am looking forward to your response.
January 19, 2016 at 10:15 am #83206MaheshParticipantHi @Lars,
I am a bit confused on what you’ve mentioned above. Do you mean to change below text for “http://energyfaculty.com/author/user” for your custom text.
“Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.”
If so, you have to create a child theme, please visit this LINK for more details on how to create child theme.
Copy following files from Catch Flames Pro theme to the child theme.
1. author.php
2. archive.phpBelow code is for
author.php
:
Replace this code
<?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'catch-flames' ); ?>
with this
<?php _e( 'Your Custom Text', 'catch-flames' ); ?>
Note: Replace “Your Custom Text” with your desired text.
Make the same change for archive.php too.
Regards,
MaheshJanuary 19, 2016 at 2:29 pm #83217LarsParticipantHello Mahesh
Thank you very much for your response.
I believe that you to a large extent have understood what I was asking for, in particular in respect of custom text. However, my request was kind of two fold:1. Changed text for archives/post/user pages not found (since our site do not use/have posts and probably will not ever), which you have responded to.
2.To return “proper” 404 response when someone (including web crawlers) try to open such, non existing (archive/post/user) pages. The reason for asking is that search engines detect and report “soft 404 errors” connected to such pages.
I look forward to your comments or proposal for question 2.
Kind regards
LarsJanuary 19, 2016 at 2:54 pm #83219MaheshParticipantHi @Lars,
I hope I understood your issue. Please clarify me if I still didn’t get you.
So you mean to display dynamic 404 page errors? Like No post found for blog error or something like that. I’m afraid it cannot be achieved as you desired. Because for the above mentioned issue we need to figure out whether it is a post/page/archive/user. We cannot get the what user/web-crawler is trying to find, which doesn’t exists in the site.I hope you understand what I mean.
Regards,
MaheshJanuary 19, 2016 at 3:09 pm #83220LarsParticipantHi again Mahesh
Thank you very much for your efforts.
I am not quite sure if I have been able to fully explain what I am looking for, so i will give it one more try.
I would like the not found message (similar to 404.php) to be displayed and responded (to users/crawlers) for all items not found on the site (pages, posts, archives,users), independent of which one it is.
I do hope this clarifies and that you are able to comment/propose solution.
Kind regards
LarsJanuary 19, 2016 at 4:35 pm #83227MaheshParticipantHi @Lars,
Yes, for all not found items in the site, “Page Not Found” message will be displayed as of
404.php
file. I you want the custom message for that then copy404.php
from Catch Flames Pro to child theme. Then modify the message as you desired.Let me know if any problems.
Regards,
MaheshJanuary 19, 2016 at 5:23 pm #83229LarsParticipantHi Mahesh
Again thank you for your response and your patience with my questions.
All is fine except when someone try to open http://energyfaculty.com/author/user/ the following text/page is displayed “Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post” (I assume from “archive.php”) and not the 404.php.And this is where search engines detect the “soft 404 error”. Can this be changed?
Kind regards
LarsJanuary 19, 2016 at 5:34 pm #83230MaheshParticipantHi @Lars,
The text message being displayed is from archive.php instead of
404.php
because in your site a user named “user” may exist. But there is no posts by that user. That is why when you visit http://energyfaculty.com/author/user/, the user exists which doesn’t give 404 error but cannot find any post by that user resulting displaying the not found message fromarchive.php
.Regards,
MaheshJanuary 19, 2016 at 6:20 pm #83233LarsParticipantHello Mahesh
That is understood.
What I actually was trying to find out is if there is any possibility of not only displaying a custom text when this occurs but also to make sure that a “proper” 404 response (for the web crawlers) is made.Kind regards
LarsJanuary 20, 2016 at 10:07 am #83298 -
AuthorPosts
- The topic ‘Page not found – 404 response’ is closed to new replies.