【发布时间】:2018-02-21 09:04:13
【问题描述】:
如何将所有 PHP 请求重写为单个特定的 url?
例如这些网址
https://somesite.com/thing.php
https://somesite.com/dir/(包含 index.php)
会被重定向到这个: https://somesite.com/dir/someotherthing.php
我还想保持客户端 URL 不变:
例如,https://somesite.com/thing.php 应该仍然是相同的 URL,而不是立即更改为 https://somesite.com/dir/someotherthing.php
另一个问题,当我这样做时,PHP 中的$_SERVER['REQUEST_URI'] 仍然是客户端的请求 URL 吗?如果没有,我如何将其传递给https://somesite.com/dir/someotherthing.php?
【问题讨论】: