Forum

Thread tagged as: Problem, Error, Blog

Blog Post 404 Error

Hi

I’ve added the blog app (like many other times on other sites) but I’m experiencing an error.

I’ve added a post and on my news feed I can see the excerpt perfectly but when I click the title or read more link to take me to the full post I get a 404 every time.


Perch: 2.8.2, PHP: 5.4.40, MySQL: 5.5.42-37.1, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (2.8.2), assets (2.8.2), categories (2.8.2), perch_blog (4.6) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', ); PERCH_LOGINPATH: /perch Image manipulation: GD Imagick PHP limits: Max upload 50M, Max POST 50M, Memory: 128M, Total max file upload: 50M Resource folder writeable: Yes

Any ideas?

I’m running perch 2.8.2 and the latest blog app which says its compatible...

Michael Kashioulis

Michael Kashioulis 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What's the URL that is 404ing, and how is it different from the URL you need for your post page?

Hi Drew,

The actual full posts url is what is 404ing.

You can see it here when yoiu click the read more from the excerpt https://www.belgravecomms.com/news.php

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you set up rewrite rules for that URL?

No dont need it...

Drew McLellan

Drew McLellan 2638 points
Perch Support

Why don't you need it? You're getting a 404, so that suggests that you do.

Hi Drew,

Thought I only needed it if I wanted clean URL's.

I have added the rewrite rules


<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^blog/([a-zA-Z0-9-/]+)$ /blog/post.php?s=$1 [L] </IfModule>

But still get the same error..

Hi Michael

Your blog is running in a folder called news not blog so you might need to change your rule (and post slug in settings) to reflect this.

Kind regards

Jon

That was my mistake. I've amended that but its still driving the same error...

Also FYI

Blog post page path= /news/{postSlug}

Drew McLellan

Drew McLellan 2638 points
Perch Support

What problem are you currently experiencing?

The same as in the first place...

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have the rewrite rules working now?

Yes the re write rule is in the htaccess and before it goes to a 404 error page I get a glimse of the url and it is convering it to a date/title format... but still going to 404

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us all the rules you have in place?

Hi Drew

This is the only rule we have in our htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^blog/([a-zA-Z0-9-/]+)$ /blog/post.php?s=$1 [L] </IfModule>

Hi Michael,

This rule is targeting /blog as Jonathan Elliman mentioned above, you are using a directory /news:

e.g. https://www.belgravecomms.com/news/2015-06-22-test-title-1

Try modifying the rule to reflect the directory name.

Hi Drew,

Sorry I changed this but just copied and pasted the one I originally sent in this thread forgetting I had amended it since...

It is stating news not blog and the error is still occuring...

Drew McLellan

Drew McLellan 2638 points
Perch Support

How are you handling the 404 redirect?

Hi Drew, What do you mean by this. Our clients hosting firm just needs a 404.php page and redirects all 404's to a page on the server names 404...

Apologies if that isnt answered properly...

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. Do you know how that happens, or is it out of your control?