开发者

Question about a redirect

开发者 https://www.devze.com 2023-03-23 23:49 出处:网络
I just noticed that sometimes (even when given a wrong url) load perfectly fine. How do they accomplish this? What I mean is, suppose you click on a link that seems good like www.foo.com but it contai

I just noticed that sometimes (even when given a wrong url) load perfectly fine. How do they accomplish this? What I mean is, suppose you click on a link that seems good like www.foo.com but it contains in the end a space character which would appear on the address bar as www.foo.com%20 some sites manage to redirect this to their correct url while others just break. How can this be achieved? I'm guessing it's something to do with the .htaccess but I have no idea what to do or where to do it.

The URL I'd like to redirect looks like this actually: http://foo.com/%C2%A0

I get the following error message:

The requested URL /%C2%A0 was not found on this server.

How can I make this redirection? So far I came up with:

RewriteEngine on
RewriteBase /
Rewri开发者_JS百科teCond %{THE_REQUEST} ^[A-Z]+\ /[^%?\ ]*\%
RewriteCond %{REQUEST_URI} !^/
RewriteRule ^(.*)$ http://www.foo.com/ [R=301,L]

but it's not working at all

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号