PHP/Apache REQUEST_URI different behaviour?

2019-05-21 13:34发布

问题:

I am moving websites from one server to another. Both are on a similar variant of Centos 5 x64 with Apache 2.2 and PHP 5.2.X.

Some of my scripts ,including Wordpress, are behaving incorrectly. It turns out the issue is the difference between the REQUEST_URI global:

On the older server: REQUEST_URI = /phpinfo.php
On the new server: REQUEST_URI = http://www.example.com/phpinfo.php

I have changed my own code to accommodate either variant but don't really want to do it for Wordpress etc.

What do I need to do in apache/php to make REQUEST_URI behave as per the old server?

回答1:

At a guess, the old server is processing the request using the default vhost while the newer server uses a named virtual host (although that could be back to front).