Forum

Thread tagged as: Problem, Blog

Blog posts not connecting despite Positive Compatibility Test

I am launching a new site in 36 hours. The staging site (on a subdomain of the same root as the site) has a fully developed blog with many posts. I have uploaded the Perch blog folder, the Perch folder, and the updated Resources folder from the subdomain to the root. I have not uploaded any of the other pages of this site.

I have run the Compatibility Test for the root and passed so I know I am connecting to the site's database. I AM able to log into the admin window for the root of this domain. I have access, through this admin window, to all of the posts that have been written. My problem is that when I go to the "www.anchoragerunfest.org/blog/index.php" the list of posts comes up fine but they do not connect to individual post pages.

I think these post pages are somehow connected to the subdomain and therefore not accessible from the root (?).

Other info: On my settings for the blog via the admin window I opted for this blog post page path earlier: /blog/{postSlug}

How do I get the posts to read from the root's blog/index.php page?

Diagnostics report:

Perch: 2.8.10, PHP: 5.3.29, MySQL: 5.5.41, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.10), assets (2.8.10), categories (2.8.10), perch_blog (4.6)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /hermes/waloraweb023/b1591/moo.anchoragerunfestorg/perch
PERCH_CORE: /hermes/waloraweb023/b1591/moo.anchoragerunfestorg/perch/core
PERCH_RESFILEPATH: /hermes/waloraweb023/b1591/moo.anchoragerunfestorg/perch/resources
Image manipulation: GD
PHP limits: Max upload 20M, Max POST 20M, Memory: 64M, Total max file upload: 20M
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: /home/users/web/b1591/moo.anchoragerunfestorg
HTTP_HOST: www.anchoragerunfest.org

This is the perch part of my index.php page:

 <div id="contentwrap">

        <h1>What's new</h1>
        <div id="leftcolumn">

            <?php 
                perch_blog_recent_posts(10);
            ?>

            <p><a href="archive.php">More posts</a></p>

            <small>Copyright © <?php echo date('Y'); ?></small>

    </div><!-- end #leftcolumnl-->

    <div id="sidelinks">
        <p class="pagelinkheader">PAST ARTICLES</p>
             <br>
            <!--  By category listing -->
            <?php perch_blog_categories(); ?>
            <!--  By tag -->
            <?php perch_blog_tags(); ?>
            <!--  By year -->
            <?php perch_blog_date_archive_years(); ?>
            <!--  By year and then month - can take parameters for two templates. The first displays the years and the second the months see the default templates for examples -->
            <?php perch_blog_date_archive_months(); ?>
    </div><!--end #sidelinks -->        

            <?php perch_get_javascript(); ?>        

    </div><!-- end #contentwrap--> 

and this is the php coded part of my post.php page:

  <div id="contentwrap">      

    <div id="leftcolumn">

       <div class="post">
                <?php perch_blog_post(perch_get('s')); ?>

                <?php perch_blog_author_for_post(perch_get('s')); ?>

                <div class="meta">
                    <div class="cats">
                        <?php perch_blog_post_categories(perch_get('s')); ?>
                    </div>
                    <div class="tags">
                        <?php perch_blog_post_tags(perch_get('s')); ?>
                    </div>
                </div>

                <?php perch_blog_post_comments(perch_get('s')); ?>

                <?php perch_blog_post_comment_form(perch_get('s')); ?>

                <br>
                <small>Copyright © <?php echo date('Y'); ?></small>

            </div><!-- end .post -->      

     </div><!-- end #leftcolumn -->      

     <div id="sidelinks">
            <p class="pagelinkheader">PAST ARTICLES</p>

           <!-- The following functions are different ways to display archives. You can use any or all of these. 

            All of these functions can take a parameter of a template to overwrite the default template, for example:

            perch_blog_categories('my_template.html');

            --> 
            <!--  By category listing -->
            <?php perch_blog_categories(); ?>
            <!--  By tag -->
            <?php perch_blog_tags(); ?>
            <!--  By year -->
            <?php perch_blog_date_archive_years(); ?>
            <!--  By year and then month - can take parameters for two templates. The first displays the years and the second the months see the default templates for examples -->
            <?php perch_blog_date_archive_months(); ?>

    </div><!-- end #sidelinks -->



    <br />
    <?php perch_get_javascript(); ?>


 </div><!-- end #contentwrap--> 

Both of these pages have this code at the top:

<?php include('../perch/runtime.php'); ?>

and the post.php file also has in its head:

<title><?php perch_blog_post_field(perch_get('s'), 'postTitle'); ?></title>

Thanking all in advance for your help on this!

Kim

Kimberly Olmsted

Kimberly Olmsted 0 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

It looks like you are rewriting URLs, what is in your htaccess file?

This is from my htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^blog/([a-zA-Z0-9-/]+)$ /blog/post.php?s=$1 [L]
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>

I really appreciate your help Rachel! In a bit of a panic mode here.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

I would suggest making sure the blog posts work correctly without the htaccess file first (so with the slug on the querystring) and then if that works finding out what the issue is with the htaccess file. That seems to be the issue rather than anything to do with Perch, but you could confirm that by getting it working without any rewriting.

Thanks rachel.

I removed the code from the htaccess file. That did not make a difference.

I then went into the Admin window settings and eliminated the following: Blog post page path: /blog/{postSlug} and Slug format: %Y-%m-%d-{postTitle} -- and saved.

With that done, I checked the blog/ index.php page again. When I clicked on a post listing title, instead of bringing up a 404.html page, I got the index.php page again. So something I did here is having an effect.

Should something else be written in the Blog post page path (jn Admin Settings) instead of "blog/{postSlug}" (or nothing as it now stands) to bring up the pertinent post.php entry when I click on a post title on the index.php page?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

If you are not rewriting URLs then you need to have the querystring that you code is expecting in the Blog post page path, if you used our examples pages that is likely to be blog.php?s={postSlug}

It is difficult for us to help with general site development problems as we do not have insight into what you have done to structure your site. Perch will support you working with or without rewritten URLS, you need to make that decision and build your site accordingly.

Thank you Rachel.

I have put blog."php?s={postSlug}" in the Blog Post Page Path in the Admin window/Settings and saved. When I tested by clicking on a post title on the index.php page, a 404.html page came up again.

I AM able to get the post if I enter the entire url like so:

www.anchoragerunfest.org//blog/post.php?s=2015-09-29-test-4

so I know the post CAN be retrieved from this root.

Are we overlooking something to do with the fact that the database was created from the staging subdomain? The compatibility test shows that the root files ARE connecting to the database.

I just sense that the problem is something very simple because the connection between index.php and the post.php pages works just fine in the subdomain. This makes me think that everything was set up well -- based on the sample php pages that came with the blog.

You are dealing with a non-php coder here.

I'm afraid I'm left with only two options: redirect the root to the working subdomain for the live site or scrap the database.

Here is what may be another clue (which I just discovered):

When I enter the Perch Admin window -- whether it be from the subdomain url or the root url, I get the same Perch Admin window -- even though I have the Perch folders in both places. Could this be the source of the problem?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

This is nothing to do with the database, you just need to use a correct path for your post page in Perch. Perch is retrieving data from the database correctly as you can see, you can load the posts.

I am not sure you saw this as my editing and your response crossed paths.

Here is what may be another clue (which I just discovered): When I enter the Perch Admin window -- whether it be from the subdomain url or the root url, I get the same Perch Admin window -- even though I have the Perch folders in both places. Could this be the source of the problem?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

I have no way of knowing how your site is configured and helping with that is very much outside the scope of support (as we don't have any way we can really help).

Your current issue is that your post path is incorrect.

In future when you need to move a site I would suggest following the information in the documentation here: https://solutions.grabaperch.com/development/how-do-i-move-a-perch-site

Thank you for your help Rachel. I am sorry there wasn't an obvious solution to this problem.

I have followed the directions you refer to although they do not address what, exactly, to do, when "moving" a site from staging to live -- if the staging is on a subdomain of the actual live site url. In this case the database does not need to be moved but is accessed by both the staging and the live site -- at the same time.

Maybe most people, when placing a staging site in the subdomain of the live site url, merely redirect the root to the subdomain when they want to go live. I think this is what I will have to do in this case since I can't fix this problem on my own.

I set up a new data base (which required running the Perch setup file to make it work) and copied and pasted the post entries and everything is working fine.

After, I made the changes for the url to be shortened and that worked as well.

Thank you for your help.