mod_rewrite的所有请求子目录 [英] Mod_rewrite all request to subdirectory
本文介绍了mod_rewrite的所有请求子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想重定向所有请求到我的网站www.example.com/page.php到www.example.com/1/page.php~~V(其中page.php任何页面请求),但我新到mod_rewrite的和无法弄清楚如何做到这一点。
I want to redirect all of the requests to my website www.example.com/page.php to www.example.com/1/page.php (where page.php is any page request), but I am new to mod_rewrite and cannot figure out how to do this.
会是什么rewrite_rule和/或条件这样做吗?
What would be the rewrite_rule and/or conditions to do this?
推荐答案
试试这个
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /1/$1 [L,QSA]
</IfModule>
我没有测试它,但它必须努力
I didn't test it, but it must work
这篇关于mod_rewrite的所有请求子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文