Home  >  Article  >  Backend Development  >  Solution to the problem that the plus sign in the URL cannot be parsed after Apache redirects with .htaccess file

Solution to the problem that the plus sign in the URL cannot be parsed after Apache redirects with .htaccess file

little bottle
little bottleforward
2019-04-25 17:20:052749browse

This article mainly talks about solving the problem that the plus sign in the URL cannot be parsed after apache uses the RewriteRule redirection in the .htaccess file. It has certain reference value. Interested friends can learn about it.

Today when using .htaccess to make pseudo-static, a strange thing happened. There will be a problem when C exists in the URL. When processing the word C, no matter what, $_GET cannot be obtained, only I can get the C space.

At first I thought it was not processed by urlencode, but later I found that it was indeed processed. After troubleshooting in the background, it was determined to be a rewrite problem, because in a single file environment, I can get C. The word, of course, has been urlencoded.

Reason: rewrite cannot get the word c because APACHE does urldecode processing on its own after getting the parameters, resulting in the inability to get the plus sign in C

I have only seen one solution so far, which is also recorded on the PHP official website. When processing c, perform urlencode processing twice, that is, urlencode(urlencode('C ')), so that when rewriting , you can get the word C.

Attached is the specific address on PHP.NET http://www.php.net/urlencode

Related tutorials: PHP video tutorial

The above is the detailed content of Solution to the problem that the plus sign in the URL cannot be parsed after Apache redirects with .htaccess file. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete