重写所有文件从newfolder到的index.html [英] Rewrite all files from newfolder to index.html
本文介绍了重写所有文件从newfolder到的index.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个code:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} (mozilla|navigator|chrome) [NC]
RewriteRule ^/newfolder/(.+) /index.html/$1 [L,NC]
我想从newfolder(位于的public_html)中的所有文件被重写的index.html这是的public_html着,当然。任何帮助,请...
I want all files from newfolder (located in public_html) to be rewrite to index.html which is in public_html, ofcourse. Any help please...
推荐答案
删除斜线从你的正则表达式匹配的URI:
Remove leading slash from your regex to match URI:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} (mozilla|navigator|chrome) [NC]
RewriteRule ^newfolder(/|$) /index.html [L,NC]
-
的.htaccess
是每个目录指令和Apache条从重写规则
URI的当前目录路径(从而导致斜线)格局。 .htaccess
is per directory directive and Apache strips the current directory path (thus leading slash) fromRewriteRule
URI pattern.
这篇关于重写所有文件从newfolder到的index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文