Dougui
Dougui

Reputation: 7230

Force the server to define $_SERVER['HTTP']

I need to copy a website from a server to another. In the first server, $_SERVER['HTTPS'] is defined but, in the second, I have this errorNotice: Undefined index: HTTPS. I don't want to change the code. I have to do multiple copies and modify the code as less as possible.

How to force the server to set a value at $_SERVER['HTTPS']?

Upvotes: 0

Views: 163

Answers (1)

Darragh Enright
Darragh Enright

Reputation: 14136

If you are using Apache, and assuming that you have .htaccess enabled you can add (or modify) this with:

SetEnv HTTPS yourvaluehere

This should define HTTPS in your $_SERVER superglobal.

If you don't want to edit .htaccess then you could set up or modify a VHost entry and SetEnv there.

Not sure how effective this will be for your codebase. YMMV.

Upvotes: 2

Related Questions