开发者

mod_rewrite redirect directory to parent directory

Recently I moved my site to Amazon EC2 instance. I want to redirect requests for

http://www.domain.com/data/
to
http://www.domain.com

so any previous paths in the old website like

http://www.domain.com/data/kjk/sds/sds/index.html should become http://www.domain.com/kjk/sds/sds/index.html

I have tried a couple of mod_rewrit开发者_开发技巧e rules using htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^data/. / [R=301,L]
</IfModule>

Any ideas?


Maybe something like this? (not tested!)

RewriteRule ^data/(.*)$ /$1 [R=301,L]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜