我想匹配一个简单的规则来重写一个url,但它只是不匹配。我想 https://example.com/web/thanks/ 重定向到 https://example.com/thanks.phphtaccess - 简单的重写规则不触发
这是我已经试过
RewriteEngine On
RewriteBase/
RewriteRule ^thanks/$ https://example.com/thanks.php [R=302,L]
RewriteEngine On
RewriteRule ^thanks/$ https://example.com/thanks.php [R=302,L]
RewriteEngine On
RewriteBase/
RewriteRule ^/(.*)/thanks/$ https://example.com/thanks.php [R=302,L]
RewriteEngine On
RewriteBase/
RewriteRule ^web/thanks/$ https://example.com/thanks.php [R=302,L]
和许多微小的变化,但他们没有被触发。我尝试使用this online tool,它返回“此规则未得到满足”。我究竟做错了什么?
你真的想重定向而不是重写吗? “不触发”是什么意思?你会得到什么,404没有找到,500服务器错误,或其他? –
最后一个应该工作,顺便说一句。至少应该将客户端重定向到PHP文件。 –
由于https://example.com/web/thanks/实际上并不存在,我得到了404。通过不触发,我的意思是规则不匹配,我不会重定向。 – VeeK