开发者

Mod_rewrite all request to subdirectory

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.

What would be the rewrite_rule and/or conditions to do this?


try 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


Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule ^page.php$ 1/page.php [NC,L]

this can go in your htaccess file but will only redirect requests to page.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜