我正在使用Yii框架,我在重定向方面遇到了问题。我想从谷歌搜索中出现的旧网址重定向到我的主页。但是重定向没有受到影响,我收到 404 错误。我可以以某种方式指定.htm扩展不会收到 404 错误而是重定向到主页吗?
这是我的htaccess文件中的重定向:
Redirect /files_mostra_milano/mostra_marionette-milano.htm http://marionettecolla.org/
旧的网址是这样的:
http://www.marionettecolla.org/file%20_mostra_milano/mostra_marionette-milano.htm
我想将其重定向到主页:
http://www.marionettecolla.org/
试试这个:
Redirect /file%20_mostra_milano/mostra_marionette-milano.htm http://www.marionettecolla.org/
如果你想使用正则表达式,试试这个:
RedirectMatch /file[ ]_mostra_milano/mostra_marionette-milano.htm$ http://www.marionettecolla.org/
最后但并非最不重要的一点是,这里有一个在线.htaccess生成器,用于创建或更新您的.htaccess。