Deny ajax file access using htaccess

The Bad: Apache 🙁 X-Requested-With in not a standard HTTP Header. You can’t read it in apache at all (neither by ReWriteCond %{HTTP_X_REQUESTED_WITH} nor by %{HTTP:X-Requested-With}), so its impossible to check it in .htaccess or same place. 🙁 The Ugly: Script 🙁 Its just accessible in the script (eg. php), but you said you don’t … Read more

PHP files are downloaded by browser instead of processed by local dev server (MAMP)

I’ve had a similar issue a couple times and renaming the file did not work for me. With OS X Lion I found the right configuration is this: <IfModule php5_module> AddType application/x-httpd-php .php <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> AddType application/x-httpd-php-source .phps <IfModule dir_module> DirectoryIndex index.php index.html </IfModule> </IfModule> The magic that made it work for … Read more

How to set global environment variables for PHP

What you want to do is use an Apache configuration file. You will need access to a configuration folder and the httpd.conf file (or modified version). You can then configure the httpd.conf to dynamically load configuration files using this approach Include conf.d/*.conf Inside the conf.d folder you place your specific environment configuration files. server-environment-dev.conf example: … Read more