How to debug Apache mod_rewrite

One trick is to turn on the rewrite log. To turn it on, try this line in your Apache HTTP Server main configuration or current virtual host file (not in .htaccess): LogLevel alert rewrite:trace6 Before Apache httpd 2.4 mod_rewrite, such a per-module logging configuration did not exist yet. Instead you could use the following logging … Read more

Why use deflate instead of gzip for text files served by Apache?

Why use deflate instead of gzip for text files served by Apache? The simple answer is don’t. RFC 2616 defines deflate as: deflate The “zlib” format defined in RFC 1950 in combination with the “deflate” compression mechanism described in RFC 1951 The zlib format is defined in RFC 1950 as : 0 1 +—+—+ |CMF|FLG| … Read more

apache redirect from non www to www

Using the rewrite engine is a pretty heavyweight way to solve this problem. Here is a simpler solution: <VirtualHost *:80> ServerName example.com Redirect permanent / http://www.example.com/ </VirtualHost> <VirtualHost *:80> ServerName www.example.com # real server configuration </VirtualHost> And then you’ll have another <VirtualHost> section with ServerName www.example.com for your real server configuration. Apache automatically preserves anything … Read more

ab load testing

The apache benchmark tool is very basic, and while it will give you a solid idea of some performance, it is a bad idea to only depend on it if you plan to have your site exposed to serious stress in production. Having said that, here’s the most common and simplest parameters: -c: (“Concurrency”). Indicates … Read more

ssl_error_rx_record_too_long and Apache SSL [closed]

The link mentioned by Subimage was right on the money for me. It suggested changing the virtual host tag, ie, from <VirtualHost myserver.example.com:443> to <VirtualHost _default_:443> Error code: ssl_error_rx_record_too_long This usually means the implementation of SSL on your server is not correct. The error is usually caused by a server side problem which the server … Read more

How do I disable directory browsing?

Create an .htaccess file containing the following line: Options -Indexes That is one option. Another option is editing your apache configuration file. In order to do so, you first need to open it with the command: vim /etc/httpd/conf/httpd.conf Then find the line: Options Indexes FollowSymLinks Change that line to: Options FollowSymLinks Lastly save and exit … Read more

Site does not exist error for a2ensite

Solved the issue by adding .conf extension to site configuration files. Apache a2ensite results in: Error! Site Does Not Exist Problem; If you found the error while trying to enable a site using: sudo a2ensite example.com but it returns: Error: example.com does not exist a2ensite is simply a Perl script that only works with filenames … Read more

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