• In the file lh-force-lowercase-urls.php, line 83.

    There is an if statement there that makes the use of the plugin impossible.
    Correct me if I am wrong but the following are my observations.

    The if statement will always fail as the $simple_path will always be different from the $parts[‘path’].

    When the url /blog/Fake-Blog-Article is visited the $simple_path will be “/blog/” and the $parts[‘path’] will be “Fake-Blog-Article”

    if you then choose to do this:

    $parts['path'] = strtolower($simple_path).$filename;

    The url will never be turned to lowercase.
    A little later you us an if statement for the following:

    if ($maybe_new_url !== $current_url){

    This will always be false as these are the values you get when I run the test:

    $maybe_new_url = "https://domain.com/blog/Fake-Blog-Article"
    $current_url = "https://domain.com/blog/Fake-Blog-Article"

    I don’t really see a reason why you would separate part of the path and add the old page name to it without lowercasing it.
    If there is a reason for it I would love to learn of it. Mostly likely I don’t know what you already did in development so don’t take this all as criticism but as something I noticed and with changes fixed for my use case.

    If this was something you missed I hope it helps.
    Otherwise looking forward to hearing I am wrong haha.

    Regards

    • This topic was modified 1 year, 6 months ago by controvi.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author shawfactor

    (@shawfactor)

    The plugin works, see example here:

    https://princesparktouch.com/ABOUT/

    redirects to

    https://princesparktouch.com/about/

    The reason for the logic is that filenames can exist with upper and lowercase, ie ABOUT.html can exist in the same directory as about.html

    Plugin Author shawfactor

    (@shawfactor)

    Note I’ve resolved the post but will still monitor the thread and re open if appropriate

    Thread Starter controvi

    (@controvi)

    Ah ok, good point.
    I did not take into account that you were thinking of file names as well.

    Then maybe you could testing for file extension in the url. Some regex to see if the url ends with “(dot)[something]” and if so don’t lowercase it.
    For normal WordPress pages there won’t be a file to browse to as it will always be loaded through the index.php.
    And as far as I know, WordPress doesn’t do extension at the end of url’s.

    But that is just a, from the top of my head, idea.
    thanks for the reply ^_^

    Thread Starter controvi

    (@controvi)

    Ow and I just thought of something but haven’t checked so sorry if I am wrong.
    But the site you used as example has a trailing slash. Could be that that is what is causing the issue.
    The site I work on doesn’t have that. Could be that that causes your check for the simple_url to fail for me.

    Plugin Author shawfactor

    (@shawfactor)

    Yes it could, WordPress natively adds trailing slashes to permalinks, but guess you have a reason why your not doing that. I’ll add the logic you outlined that looks at final part of the url to determine if has a file extension

    Btw WordPress does natively serve the robots.txt and can use other extensions with plugins.

    I have reopened the issue

    Plugin Author shawfactor

    (@shawfactor)

    Could be a few weeks until I’ve updated the plugin though

    Thread Starter controvi

    (@controvi)

    That’s fine ??
    I could make it work for my case with a small change so it is no problem.

    Will update when I see it come in ^_^

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Plugin not working’ is closed to new replies.