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]
精彩评论