redirecturl使用RewriteRule

我有一个网站,说example.com/drupal在xampp上运行

我已经将httpd.conf中的DocumentRoot更改为/ drupal /,以便我可以使用example.com访问我的网站

但Google已经抓取了我的网站,并显示了表单的结果

example.com/drupal/something

这当然要去404页。

我如何使用RewriteRulesredirect

example.com/drupal/something

example.com/something?

我只是使用标准的Apache RedirectPermanent指令,而不是试图使用相对昂贵的重写引擎的麻烦。

看看http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectpermanent

 RewriteRule ^/drupal$ / RewriteRule ^/drupal/(.*) /$1