• Resolved Will Stocks

    (@willstockstech)


    Hi guys,

    I’m hoping someone out there can help me out. Maybe there’s just a plugin I need, but I’m just not sure what to search for!!!

    I’m looking for some info relating to the standard /index.php file, which is partially matching URL’s to full URI’s, which in some cases may be fine, but in a lot it’s really not!

    So, an example (which I originally posted on: https://webmasters.stackexchange.com/questions/121146/wordpress-or-apache-or-nginx-matching-partial-url-to-full-uri thinking it was an nginx/Apache issue):

    If I navigate to a URL: https://example.com/php as an example – I would expect to receive a 404 error page here, because I don’t have anything that would directly fit that URL. However, WordPress appears to actually then redirect that URL to a “partially matching” URL of: https://example.com/php-full-article-url

    Initially, I thought “oh, wow, that’s cool – it seems to know what I’m looking for and that’s the only URI I have that matches /php*

    At that point, I then tried another URL: https://example.com/review – now this I would DEFINITELY expect to get a 404 error, because I have 40+ posts that start with /review-* – but no… instead I get one, random post.

    So, in a panic thinking I’d messed up Apache or nginx, I contacted my hosting provider (DigitalOcean) and stackexchange to verify my findings and to try and work out what I had done. They both came back saying “actually, a fresh WP install does the same!”.

    So, I suppose my question is two pronged here:

    1. Why?
    2. Surely this is “dangerous” to do? In my case, my items are all blog posts/articles, however if they were products and I had a set of products that all start with the same word in the URL, why would WP pick one item rather than showing all of them (instead of forwarding to specific URI, forward to a ?s= – otherwise it could potentially impact revenue or cause some confusion?

    So in that last example, let’s say I had a set of products:
    blue-jeans
    blue-tshirt
    blue-jumper

    If I then navigate to https://myurl/blue – what am I going to see?

    My actual, real-world example: https://willstocks.co.uk/php – which will 301 you (on the backend – no visibility of this 301 on the frontend!) to: https://willstocks.co.uk/php-dom-manipulation-snippet/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress Front Controller – Redirecting partial URLs’ is closed to new replies.