I setup a rewrite rule simply like:
RewriteRule ^product test.php
And in the test.php, it is as simple as:
<?php
echo $_SERVER["SERVER_PORT"];
?>
If I access http://localhost:6060/test.php directly, I got correct port 6060.
If I access it like http://localhost:6060/product/something.php, I got 80.
Any idea of it?
Thanks a lot.
rewrite somehow also change the SERVER_PORT value?
Moderator: General Moderators
Re: rewrite somehow also change the SERVER_PORT value?
No. What you want is to change something that happened in the past and mod_rewrite can't do that.
Re: rewrite somehow also change the SERVER_PORT value?
Do you mean the rewrite does not persevere port number? (or always change it to default 80?)
Re: rewrite somehow also change the SERVER_PORT value?
The host and port number are facts you can't change, just like the site the browser is connecting to and the IP address of the server.
To get a different port number you have to have a different port number. That is, http://localhost:80/product/something.php has to exist. Then you can do a proxy request or simply redirect the user to that location.
Now, why would you possibly need to do this?
To get a different port number you have to have a different port number. That is, http://localhost:80/product/something.php has to exist. Then you can do a proxy request or simply redirect the user to that location.
Now, why would you possibly need to do this?