WordPress.org

Ready to get started?Download WordPress

Forums

Simple URLs
Problem with URLs containing special character (3 posts)

  1. wxwalsh
    Member
    Posted 1 year ago #

    I have urls which contain the | character, such as B004R1R1SW|B003XQEVXU|B003XQEVXU

    Simple URL is stopping the processing immediately before the first | and sends nothing beyond that character.

    http://www.eliterate.org/go/a-tattoo-shop-mystery/

    Should redirect to

    http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Ddigital-text&field-keywords=B0028T82LA|B0030CVRHA|B004R1R1SW|B003XQEVXU&sort=popularity-rank&tag=cllink-20

    but instead if it is attempting to redirect to

    http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Ddigital-text&field-keywords=B0028T82LA

    http://wordpress.org/extend/plugins/simple-urls/

  2. wxwalsh
    Member
    Posted 1 year ago #

    I found where the "_surl_redirect" data is set in the mysql db, and for now just edited the URLs to change | to the url encoded %7C manually. How can I edit plugin.php for simple URL to handle this itself?

    If anyone knows...

    edit/update:
    found line 128 of plugin.php where it says:
    update_post_meta($post->ID, $key, $value);

    I tried to use urlencode($value) but that encoded the entire string, including the :// in the front, and made it unusable.

    Any alternative suggestions anyone has would be helpful.

  3. wxwalsh
    Member
    Posted 1 year ago #

    Probably not the best solution, but as an interim fix for this specific case, I added the following before line 128:

    $value = preg_replace('/\|/', '%7C', $value);

    I'm sure there is a better solution, but this will work for this specific case I have until a better fix is implemented.

    I couldn't figure it out with my limited experience, but it seems the better logic might be to split incoming urls and run urlencode($querystring) on the query string portion, and eliminate whatever the cause of the problem is.

    Or, since the URL was being saved properly in the mysql table, perhaps the better solution might be in the count_and_redirect function to fix whatever is causing it to see | as not being a part of the outputted url?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic