.htaccess: how to restrict access to a single file by IP?

This will allow either someone from IP 127.0.0.1 or logged as a valid user. Stick it either in your config or .htaccess file. <Files learn.php> Satisfy any Order deny,allow Deny from all Allow from 127.0.0.1 AuthType Basic AuthName “private” AuthUserFile /var/www/phpexperts.pro/.htpasswd AuthGroupFile /dev/null Require valid-user </Files> IP Alone: <Files learn.php> Order deny,allow Deny from all … Read more

Custom 404 error issues with Apache – the ErrorDocument is 404 as well

The ErrorDocument directive, when supplied a local URL path, expects the path to be fully qualified from the DocumentRoot. In your case, this means that the actual path to the ErrorDocument is ErrorDocument 404 /JinPortfolio/error/404page.html When you corrected it in your second try, the reason you see that page instead is because http://localhost/error/404page.html doesn’t exist, … Read more

Apache + Node.js + mod_proxy. How to route one domain to :3000 and another to :80

Just make two <VirtualHost *:80> tags <VirtualHost *:80> ServerAdmin [email protected] ServerName www.node-example.com ProxyRequests off <Proxy *> Order deny,allow Allow from all </Proxy> <Location /> ProxyPass http://localhost:3000/ ProxyPassReverse http://localhost:3000/ </Location> </VirtualHost> <VirtualHost *:80> ServerAdmin [email protected] ServerName node-example.com ProxyRequests off <Proxy *> Order deny,allow Allow from all </Proxy> <Location /> ProxyPass http://localhost:80/ ProxyPassReverse http://localhost:80/ </Location> </VirtualHost> It … Read more

Apache is “Unable to initialize module” because of module’s and PHP’s API don’t match after changing the PHP configuration

When you update the version of PHP (especially when going from version X.Y to version X.Z), you must update the PHP extensions as well. This is because PHP extensions are developped in C, and are “close” to the internals of PHP — which means that, if the APIs of those internals change, the extension must … Read more