Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a Php $_SERVER value ($_SERVER['something']) using Apache .htaccess

Tags:

Is it possible using .htaccess or other apache powers to set a custom server value in the php array $_SERVER.

for example

if($_SERVER['is_special']) {     echo "Yeah for us!"; } else {     echo "No you fool!"; } 

I realize I ask a lot of questions that the answer is no so feel free to say so.

like image 708
SeanDowney Avatar asked Mar 04 '09 20:03

SeanDowney


People also ask

What is $_ server [' Request_uri ']?

$_SERVER['REQUEST_URI'] contains the URI of the current page. So if the full path of a page is https://www.w3resource.com/html/html-tutorials.php, $_SERVER['REQUEST_URI'] would contain /html/html-tutorials. php. Following php code used $_SERVER['REQUEST_URI'] variable.

What is $_ server [' Php_self ']?

$_SERVER['PHP_SELF'] Returns the filename of the currently executing script. $_SERVER['GATEWAY_INTERFACE'] Returns the version of the Common Gateway Interface (CGI) the server is using.

Where is the .htaccess file in Apache?

htaccess file can be found at /opt/bitnami/APPNAME/. htaccess. Some applications do not have the /opt/bitnami/apache2/conf/vhosts/htaccess/APPNAME-htaccess.


1 Answers

Try the SetEnv directive:

SetEnv is_special foobar 
like image 108
Gumbo Avatar answered Sep 24 '22 20:09

Gumbo