Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何编写404重定向.htaccess代码?_.htaccess_Redirect - Fatal编程技术网

如何编写404重定向.htaccess代码?

如何编写404重定向.htaccess代码?,.htaccess,redirect,.htaccess,Redirect,我已经把我的网站从asp移到了php。 我想重定向我的旧ULR,它是 http://www.mysite.com/ABC/Home.aspx 到新的URL http://www.mysite.com 怎么做??我知道我们可以做这个。htaccess文件。但我不知道它的程序。有人能和我分享密码吗?在哪里放置此代码??在Main.htaccess文件中或在我的ABC文件夹中创建.htaccess文件???如果您的站点位于Apache服务器上,请检查此链接 编辑 在.htaccess中使用此代码

我已经把我的网站从asp移到了php。 我想重定向我的旧ULR,它是

http://www.mysite.com/ABC/Home.aspx
到新的URL

http://www.mysite.com

怎么做??我知道我们可以做这个。htaccess文件。但我不知道它的程序。有人能和我分享密码吗?在哪里放置此代码??在Main.htaccess文件中或在我的ABC文件夹中创建.htaccess文件???

如果您的站点位于Apache服务器上,请检查此链接

编辑

在.htaccess中使用此代码

ErrorDocument 404 /index.php ErrorDocument 404/index.php
我在.htaccess文件中使用了以下代码

Redirect 301 /ABC/Home.aspx http://www.addictiveblogs.com/
Redirect 301 /ABC http://www.addictiveblogs.com/
然后把这个.htaccess文件放在我的ABC文件夹中。这对我来说很好。现在将我的所有流量重定向到我的主页


来源:

上述网站使用起来非常复杂。