Forum

Thread tagged as: Question, Problem, Error

Blog post pages not loading

I have followed Blog app installation instructions and successfully have a listing of blog post created through the CMS. I have followed the clean URLs instructions accurately.

Only clicking the links to post pages goes to

Not Found -The requested URL /blog/2015-03-25-new-article-2 was not found on this server.

The URL in the browser address bar is not including the website root directory which is called 'yoga'

https://localhost/blog/2015-03-25-new-article-2

Even adding 'yoga' back in such as 'https://localhost/yoga/blog/2015-03-25-new-article-2' returns the same

Not Found -The requested URL /blog/post.php was not found on this server.


In the root directory beside perch my .htaccess file looks like this

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

In the settings panel my Blog post page path looks like this

/blog/{postSlug}
Fred Stidston

Fred Stidston 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you verified your rewrite rules are active?

Hi Drew what is the method for verifying rewrite rules?

If I type an original-style url the error is the same 'https://localhost/yoga/blog/post.php?s=2015-03-25-new-article-2'

The requested URL /yoga/blog/post.php was not found on this server.

My Perch installation needs reinstalling I think:

Adding my index page to the site root, as expected creates a page in the admin listing, and yet perch opens to the wrong url when I click 'view page' -- with two repetitions of the site root directory in the url.

My perch setting for website URL seems to require the root directory '/yoga/' or else when I click on the globe icon in the upper left of the admin it loads the parent directory of the website, localhost/, which just says 'It Works'.

If there is another way I am happy to hear about it.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Will the site be in a yoga subfolder when it goes live?

Hi Drew, no it will be at the root.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Then you should set you development site up to match. Otherwise you're creating problems for yourself.

Thanks Drew : )

In my case I'd like to have my development on localhost/yoga, which will allow me to work on multiple projects such as localhost/anotherwebsite.

Is this possible within Perch's path settings? Having bought the licence and got off to a good start, it would come as a surprise if this issue ended the fun.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

You work with multiple websites by creating virtualhosts, not putting them in subfolders. It's bad practice to change the path from root when going live - as it means that you haven't developed your site in the same structure as it will be when live. That's not just applicable to Perch but the way we auto detect pages and regions makes it especially problematic.

There are some instructions for XAMPP here https://solutions.grabaperch.com/development/installing-a-local-server-with-xampp but however you have created your local server you will be able to create proper vhosts, this will save you a lot of time and hassle when you move sites live.

Fresh install in localhost root and blog posts still not loading post.php.

No rewrite clean URL changes have been attempted at this stage.

The original issue persists, so perhaps I have marked this solved rather prematurely.


There seems to be some information missing from installation for this app.

Perhaps along the lines of: You need to create your own blog sub folder and post.php in the root directory, as the installation process will not do this automatically for you.

Drew McLellan

Drew McLellan 2638 points
Perch Support

How you structure your site and the blog within it is completely under your control. We don't impose any set structure, just provide the tools to create blog posts and output them on your site.

Hi guys,

I have a related problem and will create a virtual host as per your recommendation for my local development environment.

But my staging environment setup is completely out of my control.

I must use the path https://blazeoven.co.uk/client/williamsondacebrown/ for Perch, but I need to get approval from the client here before we push this to live (which will be on the root of the live domain).

Any suggestions for how I can do that? I currently can't view the posts and so edit the templates.

Thanks

Ah sorry I am able to change the setup after all ... thanks.

Drew McLellan said:

How you structure your site and the blog within it is completely under your control. We don't impose any set structure, just provide the tools to create blog posts and output them on your site.

Brilliant this is why I love Perch