I'm currently working with:
RewriteEngine On
RewriteBase /somepath
RewriteRule ^/$ home 开发者_如何学运维[R]
I'd like to have requests of GET /somepath
to redirect via 302 to /somepath/home
. What am I missing here?
When using mod_rewrite in an .htaccess file, the base path is removed from the requested URL path before testing the patterns. That means /somepath
(or rather /somepath/
, since you’re actually in /somepath/
) is removed so that the remaining path is empty. So:
RewriteRule ^$ home [R]
精彩评论