开发者

mod_rewrite redirect directory to parent directory

开发者 https://www.devze.com 2023-03-27 12:56 出处:网络
Recently I moved my site to Amazon EC2 instance. I want to redirect requests for http://www.domain.com/data/

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

精彩评论

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