我们已经将网站移动到另一个域并将htacess设置为如下,但如何设置规则“如果页面dosnt存在 - (即404错误)重定向到新网站主页。”如果有人跟踪我们旧网站上的破坏网址,可以用作退款。
<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.oldsite\.co\.uk)(:80)? [NC]
RewriteRule ^(.*) http://oldsite.co.uk/$1 [R=301,L]
Redirect permanent http://oldsite.co.uk http://newsite.co.uk
Redirect permanent http://oldsite.co.uk/index.html http://newsite.co.uk
Redirect permanent http://oldsite.co.uk/contact-us.html http://newsite.co.uk/contact-us.html
Redirect permanent http://oldsite.co.uk/bespoke-furniture.html http://http://newsite.co.uk/bespoke-furniture.html
Redirect permanent http://oldsite.co.uk/about-us.html http://newsite.co.uk/about-us.html
Redirect permanent http://oldsite.co.uk/how.html http://newsite.co.uk/about-us.html
order deny,allow
答案 0 :(得分:1)
你可以简单地使用它。
ErrorDocument 404 http://newsite.co.uk