WordPress.org

Ready to get started?Download WordPress

Forums

Older Entries Link Has Wrong URL (8 posts)

  1. garbles
    Member
    Posted 4 years ago #

    When my blog has more than ten entries and another page is created, there is a link that appears at the bottom of the page, "Older Entries". This link should go to the next page of posts, but has the wrong URL. My blog is http://www.sep.com/pmblog and instead of "Older Entries" having the URL of http://www.sep.com/pmblog/page/2/ it has a URL of http://www.sep.com/pmblog/pmblog/page/2/

    Can someone help me figure out how the blog owner name is being inserted into that URL twice?

    Thanks

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Try resetting your custom permalinks back to the default setting. If that works, then try reading Using_Permalinks before setting a custom permalink structure back up again.

  3. garbles
    Member
    Posted 4 years ago #

    I reset my permalinks to default and that did take care of the problem so what I ended up doing to have both my custom permalink and solve the problem is the following:

    In the link-template.php file, I found the function get_pagenum_link() that was supplying the incorrect url. I added a check to see if the blog username was being repeated:

    $pos = strpos( $base, $request );

    if ( !($pos === false) ) {
    $request = user_trailingslashit( 'page/' . $pagenum, 'paged' );
    } else {
    $request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( 'page/' . $pagenum, 'paged' );
    }

    This appears to have solved my problem without breaking anything else and I still get my custom permalink.

    Thank you for the response and please let me know if this solution is the wrong way to approach the problem.

  4. garbles
    Member
    Posted 4 years ago #

    That code was in place of:
    $request = ( ( !empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( 'page/' . $pagenum, 'paged' );

  5. esmi
    Forum Moderator
    Posted 4 years ago #

    Editing a core file is not usually the best way to solve a problem. Far better to try and figure out why you have a problem in the first place. Did you check your theme template files to see how the navigation links were being generated? Have you checked your Blog and Site urls in Settings/General? Have you tried deactivating all plugins or switching to the default theme? Did any of the preset permalink options work?

  6. garbles
    Member
    Posted 4 years ago #

    How do I find out how my navigation links are being generated? The only file in my theme folder I could see that involved the "Older Entries" link was index.php and all that did was use a method from link.template to get the url. It seems like wordpress generates the url and my theme just gets it from wordpress.

    Is it possible that I have an IIS 7 URL Rewrite problem?

    To answer your questions:
    I have tried the default theme and the problem does go away, but I don't understand how to find the problem within my own theme as far as what files actually could cause this problem.

    The only permalink option that works is the default, the other ones also add on the blog user name to the url and goes to the wrong page.

    I checked the Site URL and it is http://www.sep.com/pmblog/ which is what I want.

    Thanks for your continued help with this.

  7. garbles
    Member
    Posted 4 years ago #

    Actually, I was wrong about the default theme working. It turns out that the broken URL is fine when you navigate there from the admin page. But when I navigate to http://www.sep.com/pmblog from http://www.sep.com/blogs or just type in the URL, then the "Older Entries" URL is incorrect regardless of the theme I use. Strange that it works fine when I navigate from the admin page.

  8. MediBid
    Member
    Posted 3 years ago #

    I found this thread for the same issue of "Older Entries" getting a bad URL (.com/blog/blog/?paged=#) and after reading through all of this I think I may have found a good solution for anyone else out there:

    Esmi is right:

    Did you check your theme template files to see how the navigation links were being generated? Have you checked your Blog and Site urls in Settings/General?

    I know it is the theme as I have had the problem ever since adding the theme. But because the wordpress address and site address were different, I was getting the extra blog/ in the theme. I didn't want to pay the $68 for the theme support if I didn't have to, so this is an alternate solution. I noticed in the theme it was creating .info/blog for the older entries and I know the .info forwards to .com/blog thus giving me .com/blog/blog I'm sure this can also be edited in the theme, but I couldn't find it in the code and this solution fixed another issue I was having with the sitemap, so I'm happy.

    Solution: make the wordpress address and the site address the same in the Settings/General of wordpress. Forward a URL to your wordpress page a different way (like in GoDaddy).

Topic Closed

This topic has been closed to new replies.

About this Topic