开发者

mod_rewrite to 302 a blank query string

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]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜