开发者

mod_rewrite to 302 a blank query string

开发者 https://www.devze.com 2023-01-20 11:29 出处:网络
I\'m currently working with: RewriteEngine On RewriteBase /somepath RewriteRule ^/$ home 开发者_如何学运维[R]

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

精彩评论

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