重定向到/directory/index.html /目录/ [英] Redirecting /directory/index.html to /directory/

查看:589
本文介绍了重定向到/directory/index.html /目录/的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何这句话得到正确的搜索,所以这里去
我想对/directory/index.html所有查询重定向到/目录/
这是(真的)/directory/index.php我写了这一点,但它插入我的整个
Web根目录结构(/var/www/html/directory/index.php),所以它是一个没有去,也许
有人可以帮助我一点?这是否有意义?

这里的code


  

RewriteEngine叙述在


  
  

重写规则^指数(HTM |?HTML)$ ^的index.php [R = 301,L]


修改

我这个解决它,但我敢肯定孤单更好的办法?


  

RewriteEngine叙述在


  
  

重写规则^指数(HTM |?HTML)。$%{REQUEST_URI} /../的index.php [R = 301,L]



解决方案

这可能工作(和更清洁,我认为):

  RewriteEngine叙述在
重写规则^指数\\。(HTM |?HTML)$的index.php [QSA,NC,R = 301,L]

Hey guys I'm not sure how to phrase this to get the correct search, so here goes i would like to redirect all queries for /directory/index.html to /directory/ which is (really) /directory/index.php I wrote this out but it inserts my entire web root structure (/var/www/html/directory/index.php) so it's a no go, maybe someone could help me a bit? Does this make sense?

here's the code

RewriteEngine On

RewriteRule ^index.(htm|html?)$ ^index.php [R=301,L]

EDIT

I solved it with this, but I'm sure theres a better way?

RewriteEngine On

RewriteRule ^index.(htm|html?)$ %{REQUEST_URI}/../index.php [R=301,L]

解决方案

This might work (and is cleaner, I think):

RewriteEngine On
RewriteRule ^index\.(htm|html?)$ /index.php [QSA,NC,R=301,L]

这篇关于重定向到/directory/index.html /目录/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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