使用htaccess将损坏的index.html文件重定向到主页 [英] Redirect broken index.html files to home page using htaccess
问题描述
我想使用htaccess将损坏的index.html
文件从子文件夹重定向到主页
I want to redirect my broken index.html
files from sub folders to home page using htaccess
示例:-
http://blogs.hds.com/hdsblog/category/
http://blogs.hds.com/hdsblog/category/sustainability/page/
是断开的链接(由Google网站管理员报告).这些不存在.
are broken links (reported by Google Webmaster). These do not exist.
我想更新我的htaccess文件,以便此类URL自动重定向到我网站的首页.
I want to update my htaccess file, so that URLs like these automatically redirect to the home page of my site.
推荐答案
您可以使用简单的 RewriteRule
这些URL
You can use a simple RewriteRule
for these URLs
RewriteRule ^hdsblog/category/ / [R,L]
这会将所有以/hdsblog/category/
开头的请求(包括/hdsblog/category/sustainability/page/
)重定向到您的首页http://blogs.hds.com/
.
This redirects all requests starting with /hdsblog/category/
, including /hdsblog/category/sustainability/page/
to your home page http://blogs.hds.com/
.
如果您只想重定向这些确切的请求,则必须指定多个RewriteRule
If you want to redirect only these exact requests, you must specify multiple RewriteRule
s
RewriteRule ^hdsblog/category/$ / [R,L]
RewriteRule ^hdsblog/category/sustainability/page/$ / [R,L]
这篇关于使用htaccess将损坏的index.html文件重定向到主页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!