当url中有空格时htaccess重定向

2024-04-30

我想从仍然出现在谷歌搜索中的旧网址重定向到新网址。旧的网址是这样的:

http://www.marionettecolla.org/file%20_mostra_milano/mostra_marionette-milano.htm

我想将其重定向到主页:

http://www.marionettecolla.org/

我在 .htaccess 中使用了它:

Redirect http://marionettecolla.org/file\ _mostra_milano/mostra_marionette-milano.htm http://marionettecolla.org/

但我收到错误 500...有人知道如何解决这个问题吗?


这应该有效:

Redirect 301 "http://marionettecolla.org/file _mostra_milano/mostra_marionette-milano.htm" http://marionettecolla.org/

只需将其放在一对双引号之间" ... "

Update:

这也是另一种方式,应该适用于任何类型的空间:

redirectMatch 301 http://marionettecolla.org/file[\s]_mostra_milano/mostra_marionette-milano.htm http://marionettecolla.org/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

当url中有空格时htaccess重定向 的相关文章