How to check if mod_rewrite is enabled in php?

If you’re using mod_php, you can use apache_get_modules(). This will return an array of all enabled modules, so to check if mod_rewrite is enabled, you could simply do in_array(‘mod_rewrite’, apache_get_modules()); Unfortunately, you’re most likely trying to do this with CGI, which makes it a little bit more difficult. You can test it using the following, … Read more

Can I Replace Apache with Node.js?

If you’re prepared to re-write your PHP in JavaScript, then yes, Node.js can replace your Apache. If you place an Apache or NGINX instance running in reverse-proxy mode between your servers and your clients, you could handle some requests in JavaScript on Node.js and some requests in your Apache-hosted PHP, until you can completely replace … Read more

How to prevent browser page caching in Rails

I finally figured this out – http://blog.serendeputy.com/posts/how-to-prevent-browsers-from-caching-a-page-in-rails/ in application_controller.rb. After Ruby on Rails 5: class ApplicationController < ActionController::Base before_action :set_cache_headers private def set_cache_headers response.headers[“Cache-Control”] = “no-cache, no-store” response.headers[“Pragma”] = “no-cache” response.headers[“Expires”] = “Mon, 01 Jan 1990 00:00:00 GMT” end end Ruby on Rails 4 and older versions: class ApplicationController < ActionController::Base before_filter :set_cache_headers private def … Read more

.htaccess ErrorDocument 404 not showing up

First, note that restarting httpd is not necessary for .htaccess files. .htaccess files are specifically for people who don’t have root – ie, don’t have access to the httpd server config file, and can’t restart the server. As you’re able to restart the server, you don’t need .htaccess files and can use the main server … Read more

Do I need to convert .CER to .CRT for Apache SSL certificates? If so, how?

File extensions for cryptographic certificates aren’t really as standardized as you’d expect. Windows by default treats double-clicking a .crt file as a request to import the certificate into the Windows Root Certificate store, but treats a .cer file as a request just to view the certificate. So, they’re different in the sense that Windows has … Read more

Reference: mod_rewrite, URL rewriting and “pretty links” explained

To understand what mod_rewrite does you first need to understand how a web server works. A web server responds to HTTP requests. An HTTP request at its most basic level looks like this: GET /foo/bar.html HTTP/1.1 This is the simple request of a browser to a web server requesting the URL /foo/bar.html from it. It … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)