I noticed that when using mod\_rewrite, PHP returns server\_port 80 even if apache is on port 8080.

i.e I have this url: <http://myvirtualhost.8080/index.php> and this PHP snippet:

```
<?php echo $_SERVER['SERVER_PORT']; ?>

```

In .htaccess I have this simple rule

```
RewriteEngine on
RewriteRule     ^/?$            index.php           [NC,L]

```

With mod\_rewrite on, output is "80" (wrong)

With mod\_rewrite off, output is "8080" (correct)

Is it normal? Anysimple solutions for this?
The fact is that i need to check the REAL server port to use in a conditional PHP script, something like:

```
<?php 
if ($_SERVER['SERVER_PORT'] == 80) {
do something
} else {
do something else
}
?>

```

and of course this is actually not possible since with mod\_rewrite on the SERVER\_PORT is always 80. I prefer not to mess with .htaccess file, so a PHP script solution would be great...

Thanks in advance!