Title: URL Encoding on directory names
Last modified: August 30, 2016

---

# URL Encoding on directory names

 *  [Matt](https://wordpress.org/support/users/syntax53/)
 * (@syntax53)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/url-encoding-on-directory-names/)
 * In inc.directories.php you don’t seem to be urlencoding the directory names. 
   I have a directory with an ampersand in it and clicking the link just refreshes
   the page because it’s a bad link.
 * I modified line #120 from
    `$dlink = str_replace('/', '*', "$dpath");`
 * to
    `$dlink = urlencode(str_replace('/', '*', "$dpath"));`
 * and the problem is solved.
 * [https://wordpress.org/plugins/file-away/](https://wordpress.org/plugins/file-away/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [Matt](https://wordpress.org/support/users/syntax53/)
 * (@syntax53)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/url-encoding-on-directory-names/#post-6245537)
 * The issue still persists for the path listing just above the table though. Not
   sure which file that falls into.
 *  Plugin Author [thomstark](https://wordpress.org/support/users/thomstark/)
 * (@thomstark)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/url-encoding-on-directory-names/#post-6245552)
 * That would be lib/inc/inc.directories-nav.php
 * Adding it to line 30 should work:
 * `$crumbies .= '<a href="'.fileaway_utility::querystring(get_permalink(), $_SERVER["
   QUERY_STRING"], array("drawer".$drawerid => urlencode($crumblink[$k]))).'">'.
   $prettycrumb.'</a> / ';`
 * Thanks for all your troubleshooting on this.
 *  [cullaloe](https://wordpress.org/support/users/cullaloe/)
 * (@cullaloe)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/url-encoding-on-directory-names/#post-6245905)
 * Thank you, Matt and Thom. This works a treat. Will this mod make an appearance
   in future updates, or am I going to have to remember to re-apply the changes?
   I hate remembering stuff.
 *  [misterboo](https://wordpress.org/support/users/misterboo/)
 * (@misterboo)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/url-encoding-on-directory-names/#post-6245906)
 * Came across this thread when I was having problems with ampersands in directory
   names and it has helped with all but one problem…
 * I am trying to add sub to my shortcode using a directory with an ampersand (i.
   e. sub=”Health & Safety”) but I just get a blank page returned.
 * Can anybody help?
 *  Thread Starter [Matt](https://wordpress.org/support/users/syntax53/)
 * (@syntax53)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/url-encoding-on-directory-names/#post-6245907)
 * edit: actually nevermind, what i originally just posted wont help you.
 * there probably needs to be a “html_entity_decode” somewhere.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘URL Encoding on directory names’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/file-away_e3e2e1.svg)
 * [File Away](https://wordpress.org/plugins/file-away/)
 * [Support Threads](https://wordpress.org/support/plugin/file-away/)
 * [Active Topics](https://wordpress.org/support/plugin/file-away/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/file-away/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/file-away/reviews/)

 * 5 replies
 * 4 participants
 * Last reply from: [Matt](https://wordpress.org/support/users/syntax53/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/url-encoding-on-directory-names/#post-6245907)
 * Status: not resolved