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

little bottle
Release: 2023-04-06 11:28:02
forward
2878 people have browsed it

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!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template