• Resolved Lee Hodson (VR51)

    (@leehodson)


    This relates to manual redirects.

    The Issue

    When a manual redirect is set, many people might forget to add the trailing slash. This means the redirect fails when a referring link uses a trailing slash but the configured redirect does not; the same is true vice versa.

    For example

    example.com/apples is not the same as example.com/apples/

    Likewise

    example.com/apples/ is not the same as example.com/apples

    When slug lacks a trailing slash the redirect only works when the link followed lacks the trailing slash.

    When slug has a trailing slash the redirect only works when the link followed has the trailing slash.

    When I set manual redirects I use the non trailing slash version of the redirected URL slug then add .? to the end of it (I know I could, probably should, use a a forward slash instead of a dot) and set the redirect as a regex.

    Another option is to use two separate redirects: one with and one without the trailing slash.

    The Request

    Can you add a tick-box option to cover trailing slashes e.g. ‘This redirect should work whether there is or is not a trailing slash (yes/no)’ i.e /? or \/? (I’m not sure whether forward slashes need to be commented or not for 404 Solution).

    Can you add a tick-box to cover the redirected slug and anything that might follow it e.g ‘This redirect should work for this slug and any extensions of this slug (yes/no)’ i.e .*? or .+? or \/?.*? etc.., whichever is less resource hungry.

    I think this will be easier for people unfamiliar with regexes to understand.

    Thank you for your great work on 404 Solution.

    Lee

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Aaron

    (@aaron13100)

    Hey Lee,

    I just made it work with or without a slash. Please try version 2.21.19 and let me know how it goes.

    thanks

    Thread Starter Lee Hodson (VR51)

    (@leehodson)

    Thanks Aaron. I will test over the next few days.

    Plugin Author Aaron

    (@aaron13100)

    Hey. Let me know if there are issues with this.
    thanks

    Thread Starter Lee Hodson (VR51)

    (@leehodson)

    Hi Aaron,

    I apologise for my late reply. I have been ill the past few weeks.

    Just gotten around to testing this. For some strange reason the redirects no longer work at all.

    I will see whether I can discover any faults. If i can I will let you know.

    Edit:

    It’s strange. I can only attest to what I know as of today, having not checked before today.

    – Manual redirects created before today seem to work as expected.
    – A manual redirect edited today does not work.
    – Deleting the edited redirect and creating it afresh did not resolve the fault.
    – Automatic redirects appear to work fine.
    – I tested manual redirects with the option to create automatic redirects disabled.
    – I purged all automatic redirects, ran maintenance and further optimized the database with WP Optimize. This did not solve the problem.
    – I cleared the website cache, the CDN cache and the browser cache + restarted the browser and tried with a VPN. The new redirect still failed to work.
    – htaccess does not include any redirects for this particular 404 Solution redirected page.
    – The 404 Solution debug log is empty. It wasn’t until I cleared it 30 minutes ago. No new logs have been written to it.
    – No errors related to this issue have been recorded by the server.
    – No errors are being sent to me via Fatal Error Notify (a WordPress plugin that reports errors).
    – WP Debug is not reporting any 404 Solution / redirect errors.

    I will check on this again in a couple of hours just in case there is another network cache set by the site’s host or my ISP. Will keep you informed.

    Plugin Author Aaron

    (@aaron13100)

    Please turn on debug logging and see what’s happening. The debug log and the delete action can be found under Settings -> 404 Solution -> Options -> Advanced Settings Etc

    1. Delete the debug log.
    2. Turn on debug logging (click Save after checking the option)
    3. Go to the URL that doesn’t work.
    4. Go back to the settings page and click View the debug log.
    5. Paste the contents of the log file to pastebin.com (for example)
    6. Post the link created at pastebinn.com here.

    thanks

    Thread Starter Lee Hodson (VR51)

    (@leehodson)

    Thanks Aaron. I must have edited my post while you were writing your reply. The debug log is empty. No new items were written to it. It is as though 404 Solution is not seeing the page request.

    In a couple of hours I will retest. Could be a quirk in the network used by the host. Maybe there’s some request caching going on.

    Thread Starter Lee Hodson (VR51)

    (@leehodson)

    I know what is happening.

    404 Solution is ignoring manual redirects created for pages that actually exist within the site. I tested this with a dummy page. Once a redirected page is removed from the site the redirect begins to work again.

    There has been nothing new added to the debug log.

    Plugin Author Aaron

    (@aaron13100)

    If I understand correctly then this is working as expected. If the page exists there is no redirect. The plugin only listens for 404s. Did I understand correctly?

    Thread Starter Lee Hodson (VR51)

    (@leehodson)

    You did understand correctly. I thought 404 could be used to create general redirects too?

    Plugin Author Aaron

    (@aaron13100)

    Ah, no. Only 404s. What’s the purpose of redirecting a user that goes to a page that exists?

    Thread Starter Lee Hodson (VR51)

    (@leehodson)

    You would be surprised how some sites are set up. Generally, I agree with you. What if the page is put into draft, will that trigger 404 Solution when the page is requested?

    Edit: I can answer that. Putting a post/page into draft triggers 404 Solution redirects for anonymous visitors but not for logged in users with permission to view or edit draft posts.

    Plugin Author Aaron

    (@aaron13100)

    404 Solution uses https://developer.www.ads-software.com/reference/hooks/template_redirect/ and https://developer.www.ads-software.com/reference/functions/is_404/.

    Let me know if you want to explain the use case for redirecting existing pages. Otherwise I think the original issue is solved so.

    cheers

    Thread Starter Lee Hodson (VR51)

    (@leehodson)

    Looks good on my end. Thank you so much, Aaron.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Feature Request’ is closed to new replies.