Search code examples
phplitespeed

PHP_SELF including hostname and protocol


The $_SERVER["PHP_SELF"] variable on my hosting has suddenly started returning the full protocal and host on SSL enabled accounts and I can't for the life of me work out why. I've googled high and low. I didn't change anything on the server.

I setup a dummy file to output the PHP_SELF value. On my local machine (no SSL) it shows as /phpself.php (which is the behaviour I expect). On the SSL enabled accounts it's coming back as https://www.example.com/phpself.php. This isn't in the doco.

According to the hosting company when they renamed the .htaccess file the variable returned the "correct" file name (without host).

Can anyone explain what is going on? Makes no sense to me as I thought PHP_SELF was a core PHP variable that couldn't be touched by URL rewrites or anything like that. RewriteEngine on

Options -Indexes

RewriteCond %{HTTP_HOST} ^example\.com\.au$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com\.au$
RewriteRule ^(.*)$ "https\:\/\/www\.example\.com\.au\/$1" [R=301,L]

The .htaccess file was created by cPanel after a redirect was created, not by me by hand. Again though, this behaviour started suddenly, out of the blue... not as a result of me changing the .htaccess file.


Solution

  • The bug has been fixed in 5.3.4 build 6, please update or inform your host provider to update.