Home  >  Article  >  Backend Development  >  在.htacess中重写url相关问题

在.htacess中重写url相关问题

WBOY
WBOYOriginal
2016-06-23 13:57:05893browse

重写url的时候遇到一个问题,如果原url中有空格的话,那个空格要如何表示啊

例:

RewriteRule ^Activites/([A-Za-z]*)$ pages%20referencement/le-bon-courtier-nos-activites-$1.php


空格那里我是拿%20替换的,但是不幸的是,根本不管用

我把空格去了,然后就可以用了

求大神指教啊啊啊啊


回复讨论(解决方案)

apache 获取到的url是已经解码的,你这样写当然不对,空格直接写,但为了保证完整的字符串及$的转义,需要加双引包含。这样写就可以了。

RewriteRule ^Activites/([A-Za-z]*)$ "pages referencement/le-bon-courtier-nos-activites-$1.php"

apache 获取到的url是已经解码的,你这样写当然不对,空格直接写,但为了保证完整的字符串及$的转义,需要加双引包含。这样写就可以了。

RewriteRule ^Activites/([A-Za-z]*)$ "pages referencement/le-bon-courtier-nos-activites-$1.php"


谢谢,受教了~
Statement:
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