4

I'm currently working on a new website that I need to migrate from an old CMS to WordPress. The old system had some URL values with ID's in it:

http://www.domain.ltd/page+1234. 

When I place this url in WordPress, the URL gets a 301 redirect to the same URL with the value: %2B. Can someone help me out to get rid of the redirect and just show the URL with the +?

1
  • 3
    If you found a solution yourself, pleace write it as an answer and accept it, so it may help others to see that this question was solved, thanks.
    – birgire
    Commented Jul 27, 2016 at 14:11

1 Answer 1

3

Per the OP, here is their answer which I separated from the question:

I have found a solution for it myself, I've used the Custom Permalinks plugin and edited how the special characters are saved in the database. For the people who want to use this, change:

add_post_meta( $id, 'custom_permalink', str_replace('%2F', '/',
urlencode(ltrim(stripcslashes($_REQUEST['custom_permalink']),"/"))) );

to

add_post_meta( $id, 'custom_permalink', str_replace(array('%2F','%2B'),
array('/','+'),
urlencode(ltrim(stripcslashes($_REQUEST['custom_permalink']),"/"))) );
1
  • @TimMalone Sure thing. Commented Aug 25, 2016 at 4:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.