Broken PHP Code : “Allowing Slashes in the URL Path With Apache”

I had a problem where I needed to pass an LDAP URL with two forward slashes 

ldaps://ldap.blah.com

in some PHP code. I couldn’t get it to work but I found out how to fix it: 

I had to configure Apache to allow encoded slashes with AllowEncodedSlashes Onin the relevant vhost by adding :

<VirtualHost 127.0.0.1:80>
AllowEncodedSlashes On
# ...
</VirtualHost>

Into the /etc/apache2/apache2.conf config file. I then ran 

sudo service apache2 restart

And the problem was fixed.

Leave a Comment

Your email address will not be published. Required fields are marked *