.htaccess htaccess读取空格“;在此服务器上找不到“;
我有个小问题。我正在使用htaccess来创建更用户友好的url,但当我在url中添加一些空格时,会出现下一个错误:.htaccess htaccess读取空格“;在此服务器上找不到“;,.htaccess,url,mod-rewrite,url-rewriting,rewrite,.htaccess,Url,Mod Rewrite,Url Rewriting,Rewrite,我有个小问题。我正在使用htaccess来创建更用户友好的url,但当我在url中添加一些空格时,会出现下一个错误: The requested URL /capitole/Limba Engleza was not found on this server. 我的htaccess代码如下所示: <ifModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteRule nota.jpg php/img_nota.php
The requested URL /capitole/Limba Engleza was not found on this server.
我的htaccess代码如下所示:
<ifModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule nota.jpg php/img_nota.php [R=301]
RewriteRule ^login login.php
RewriteRule ^recuperare recuperare.php
RewriteRule ^inregistrare inregistrare.php
RewriteRule ^/?([\sa-zA-Z0-9_-]+)(/?([a-z0-9=]+)(/=)?([a-z0-9=]+)?)?$ index.php?page=$1&par1=$3&par2=$5 [NC,L]
</ifModule>
重新启动发动机
重写基/
重写规则nota.jpg php/img_nota.php[R=301]
重写规则^login login.php
重写规则^Reciperare.php
在registrare.php中重写规则^inregistrare
重写规则^/?([\sa-zA-Z0-9_-]+)(/?([a-Z0-9=]+)(/=)?([a-Z0-9=]+)?$index.php?页面=$1&par1=$3&par2=$5[NC,L]
有人能帮我吗?URL不能包含空格。URL中的空白使用百分比(%)进行编码 如果它是一个查询字符串(之后?),通常使用操作符
+
(例如:big+ships
)。
如果字符串位于URL路径中,则使用%20
(例如:big%20ships
)
如RFC中所述:
空格字符被排除在外,因为有效空格可能当URI为
转录的、排版的或经过word处理的-
处理程序。在许多情况下,空白也用于分隔URI
上下文 空格=US-ASCII编码字符20十六进制
您的第二段不接受
空格
将其修改为如下内容
RewriteRule ^/?([\sa-zA-Z0-9_-]+)(/?([\sA-Za-z0-9=]+)(/=)?([a-z0-9=]+)?)?$ index.php?page=$1&par1=$3&par2=$5 [NC,L]
虽然规则可能是正确的,但URL中仍然不允许使用空格。在现代浏览器中,空格会转换为
%20
。