Forums

Navigation link showing wrong url (10 posts)

  1. codecanvas
    Member
    Posted 3 years ago #

    Hi,
    Good day everyone! I am having a minor issue with my wordpress blog, the "Next Page" navigation link is currently linking to http://{domain}/index.phpIndex.php/page/2/ whereas it is supposed to link to http://{domain}/index.php/page/2/ (extra Index.php) I checked through the administrative panel and source code of various 'posts' functions but not able to pin point the exact place of trouble. If anyone knows of a suitable solution please do let me know.

    Thanks
    Vijay

  2. codecanvas
    Member
    Posted 3 years ago #

    Well, thanks for the overwhelming replies. I traced down the problem to the function 'get_pagenum_link' in the file 'wp-includes/template-functions-links.php'.

    it I had to do two things to solve this issue, first at line 426 where it says

    $qstr = '/' . $index . $qstr;

    the extra addition of $index variable has to taken off, so basically it becomes

    $qstr = '/' . $qstr;

    this will solve the issue of having two index.php files mentioned in the navigation link, but still the navigation link will have the default file displayed as "Index.php" instead of "index.php" (case sensitive)

    to solve this issue after line number 392 where it says

    $qstr = preg_replace('|^/+|', '', $qstr);

    add this line

    $qstr = 'index.php';

    I guess there should be a better way to make the second point happen, but since I am not an expert in PHP and I have to make a fix for the time being this will do.

    posted the above message so just in case it will solve some other poor soul who maybe stuck with the same issue.

    Regards,
    CC

  3. moshu
    Member
    Posted 3 years ago #

    Thanks for posting back the solution.
    Though I have to confess this is the first time I hear about the necessity of changing core file to make this working. Are you sure it is not related to your server's settings?

    If you think it's a bug, please post it to http://trac.wordpress.org/

  4. codecanvas
    Member
    Posted 3 years ago #

    Thanks for the suggestion moshu, it maybe my hosting environment thats causing the problem but I wont be able to do much about it because

    1) I am hosting in a shared plan, so I cannot change server based settings for my domain which may affect other users

    2) I am hosting on a Windows 2003 server with PHP ISAPI. I also tested the blog (with the backup from online db installed locally) in my Win XP Pro SP2 machine and had the same issue.

    So maybe we would need to check the code for windows based hosting environments.

    Regards,
    CC

  5. codecanvas
    Member
    Posted 3 years ago #

    also, I tried visiting the bug submission page and I receive the following error:

    TICKET_CREATE privileges are required to perform this operation

    I tried using the 'Login' option and provided by wordpress login details, but there is no confirmation about if I have logged in successfully or not. and when I visit the bug submission page again I get the same error message.

  6. codecanvas
    Member
    Posted 3 years ago #

    Sorry, the issue was with Internet Explorer 7, I tried the same on Opera 9 and it is working fine.

  7. Magganpice
    Member
    Posted 2 years ago #

    Thanks for the solution.

    This problem affects all (?) Wordpress installations on Windows Servers using date and title permalink structure.

    NOTE: the first change ($qstr = '/' . $qstr;) is NOT necessary! Just do the second change and all is well...

  8. Magganpice
    Member
    Posted 2 years ago #

    Another hint: the file you're looking for is calles link-template.php in the current wordpress installations.

    (yes, the problem is still there in Wordpress 2.1)

  9. wmernagh
    Member
    Posted 2 years ago #

    This fix worked for me. But then it broke the next link in archive pages :(

    So I still need to get a better fix. I think the problem is that the IIS server comverts http://www.example.com into http://www.example.com/Index.php not http://www.example.com/index.php

  10. wmernagh
    Member
    Posted 2 years ago #

    So I managed to fix the problem. If you put

    $qstr = str_replace("index.phpIndex.php", "index.php", $qstr);

    Right before the return of the get_pagenum_link() function it will replace the occurrence of index.phpIndex.php with index.php.

    The previously posted fix works for the main page but if you look at an archive page like http://www.example.com/index.php/2007/ the next link will point to http://www.example.com/index.php/page/2/ not http://www.example.com/index.php/2007/page/2/

    This new fix will work on all pages

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.