• Resolved SCAND

    (@scandltd)


    Hi.

    The Source URL /blog/2012/12/20/i-draw-a-new-year/ is not working, but /blog/2012/12/20/i-draw-a-new-year is okay.

    I’ve spent about 2 hours for debug and found this

    A slash is cut out from the passed $url and the query inside the method $url->get_url() works incorrectly:
    SELECT * FROM wp_redirection_items WHERE match_url='/blog/2012/12/20/i-draw-a-new-year' OR match_url='regex'
    instead of
    SELECT * FROM wp_redirection_items WHERE match_url='/blog/2012/12/20/i-draw-a-new-year/' OR match_url='regex'

    Could you explain why should use the Red_Url_Match class if $wpdb->prepare is sanitize the passed value?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author John Godley

    (@johnny5)

    The query is correct, and the data is normalized. There’s no need to spend so much time digging into the code.

    You can use the ‘ignore trailing slash’ parameter to ignore the trailing slash.

    Thread Starter SCAND

    (@scandltd)

    I have spent so much time to make sure that this problem is not related to other plugins, just to save your time.

    If create a new redirect with the ‘Ignore slash’ option, it works. But this won’t work for us (as for many other people, I assume) because we already have a lot of redirects and they all have a slash as they were stored before you added the ‘Ignore slash’ option.

    I have to update DB directly to remove slashes and set the properly value for match_data column.

    In any case, I guess this info will helpful for other people.

    Thanks.

    Plugin Author John Godley

    (@johnny5)

    The options page contains the global slash setting, and it’s not necessary to update the database.

    Thread Starter SCAND

    (@scandltd)

    The global option does not work for me, I tried to use it.

    Your SQL query uses the condition for match_url via “=”. So, if the data for match_url were stored with a slash at the end, the result is empty.

    I think that the global option will work correctly if we create a new redirect, but not for existing data.

    Plugin Author John Godley

    (@johnny5)

    The data will have been normalized. All these situations have been designed for in the plugin.

    If you have the global option set and you then change a redirect to not ignore trailing slashes then it won’t match, but if you have not changed the default value in the redirect, and change the global option, then it should match.

    Thread Starter SCAND

    (@scandltd)

    As I wrote we have many redirects and use your plugin a lot of years. Data is existing, but stored incorrectly. Probably, the issue related with migration to new version of our site and new DB accordingly.

    Please resolve the issue, all is ok.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Source URL with slash at the end’ is closed to new replies.