.htaccess htaccess:模拟URL上的切换情况,尤其是';默认值';
我有一个网站,我必须重写与htaccess网址。有没有办法像处理开关的case语句一样处理这个问题 假设我的网站是foobar.com,我想要 foobar.com/red=>foobar.com/republican.php foobar.com/blue=>foobar.com/democratir.php foobar.com/green/xyz=>foobar.com/green.php?id=xyz 默认值: foobar.com/*=>foobar.com/page.php?查询=* 目前,这是我的设置:.htaccess htaccess:模拟URL上的切换情况,尤其是';默认值';,.htaccess,url,.htaccess,Url,我有一个网站,我必须重写与htaccess网址。有没有办法像处理开关的case语句一样处理这个问题 假设我的网站是foobar.com,我想要 foobar.com/red=>foobar.com/republican.php foobar.com/blue=>foobar.com/democratir.php foobar.com/green/xyz=>foobar.com/green.php?id=xyz 默认值: foobar.com/*=>foobar.com/page.php?查询=*
RewriteRule ^/red foobar.com/republican.php [works fine]
RewriteRule ^/blue foobar.com/democrat.php [works ok]
RewriteRule ^green/([^/.]+)/?$ green.php?id=$1
[error: redirect loop with foobar.com/green/home.php in browser address because green.php without id set redirects to home.php]
default [no idea how to implement]
找到了这样做的方法: 请参见上的“使用路由文件”