Relative URLs do not recognize%2f

Source: Internet
Author: User

A recent project found that%2f's relative URL was identified, resulting in 404 errors.

Url:http://w3schools.com/xxx%2fxxx%2ftest.asp?name=stale&car=saab


This behavior occurs because Apache does not recognize the encode URL.

You can add allowencodedslashes on to the configuration file to resolve it.

<virtualhost *:80>
DocumentRoot "/var/www/weble.org/app/webroot"
ServerName weble.org
Allowencodedslashes on
<directory "/var/www/weble.org/app/webroot" >
Order Deny,allow
Allow from all
</Directory>
</VirtualHost>


There is also a solution is in the picture of the problem, call JS decodeURIComponent method.

Encode and decode a URI: <script type= "Text/javascript" >

var uri= "Http://w3schools.com/my Test.asp?name=ståle&car=saab";
var uri_encode=encodeuricomponent (URI);
document.write (Uri_encode);
document.write ("<br/>");
document.write (decodeURIComponent (Uri_encode));

</script>

The output of the code above would Be:http%3a%2f%2fw3schools.com%2fmy%20test.asp%3fname%3dst%c3%a5le%26car%3dsaab
Http://w3schools.com/my Test.asp?name=stale&car=saab

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.