重定向到/directory/index.html /目录/ [英] Redirecting /directory/index.html to /directory/
问题描述
我不知道如何这句话得到正确的搜索,所以这里去
我想对/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屋!