重定向301 - 为什么我的旧的URL被添加到我的新网址导致404错误? [英] Redirect 301 - why is my old url being appended to my new url causing a 404 error?

查看:193
本文介绍了重定向301 - 为什么我的旧的URL被添加到我的新网址导致404错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Redirect 301 /features/blahblah.php http://www.mysite.com/articles/blahblah1.php

结果 http://www.mysite.com/文章/ blahblah1.php?Q =功能/ blahblah.php 未找到404错误页面。

results in http://www.mysite.com/articles/blahblah1.php?q=features/blahblah.php which is a 404 error page not found.

所以我在做什么错在这里

So what am i doing wrong here

推荐答案

http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect 文件究竟发生了什么。

http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect documents exactly what's happening.

您可能需要使用RedirectMatch,是这样的:

You probably want to use RedirectMatch, something like:

RedirectMatch ^/features/blahblah.php http://www.mysite.com/articles/blahblah1.php

如果你希望它是一个永久重定向,HTTP状态301(可以是理想的搜索引擎优化的目的),而不是暂时性302重定向,然后改用:

If you want it to be a "permanent" redirect with HTTP status 301 (which can be desirable for SEO purposes) rather than a temporary 302 redirect, then instead use:

RedirectMatch permanent ^/features/blahblah.php http://www.mysite.com/articles/blahblah1.php

这篇关于重定向301 - 为什么我的旧的URL被添加到我的新网址导致404错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆