background preloader

Apache

Facebook Twitter

.htaccess snippets to optimize your website. All of the snippets below have to be pasted into your .htaccess file, which is located on the root of your Apache server.

.htaccess snippets to optimize your website

Waring: Always make sure you have a working backup before editing your .htaccess file! Force trailing slash Many clients of mine asked me for always having a trailing slash at the end of their urls. Looks like it’s great for SEO. The following snippet will alwyas add a trailing slash to your site urls. <IfModule mod_rewrite.c> RewriteCond %{REQUEST_URI} /+[^\.]+$ RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] </IfModule> Source: Prevent hotlinking Hotlinking (the act of using images from another site than yours) is unfortunely a common practice which can waste lots of your precious bandwidth. Source: Redirect mobile devices If your site is not using responsive web design yet, it could be very useful to be able to redirect mobile device to a mobile-specific version of your website.

RewriteEngine On RewriteCond %{REQUEST_URI} ! Source: Force download of a specific filetype. Disabling unnecessary modules. The Debian Administrator's Handbook. The Falcot Corp administrators decided to use the Apache HTTP server, included in Debian Squeeze at version 2.2.16. 11.2.1.

The Debian Administrator's Handbook

Installing Apache By default, installing the apache2 package causes the apache2-mpm-worker version of Apache to be installed too. The apache2 package is an empty shell, and it only serves to ensure that one of the Apache versions is actually installed. The differences between the variants of Apache 2 are concentrated in the policy used to handle parallel processing of many requests; this policy is implemented by an MPM (short for Multi-Processing Module). The Falcot administrators also install libapache2-mod-php5 so as to include the PHP support in Apache. Apache is a modular server, and many features are implemented by external modules that the main program loads during its initialization. 11.2.2. A virtual host is an extra identity for the web server. Each extra virtual host is then described by a file stored in /etc/apache2/sites-available/. Example 11.16. Visual Domain Routing. When troubleshooting a website issue, if you were to start at step 1, it would be checking to make sure that your domain name is registered and that the DNS is routing your domain name to the correct web server.

Visual Domain Routing

When checking the routing of a domain name, most professional use tools such as dig / ping / tracert. For the average user that does not perform this type of test on a regular basis, connecting the dots to see how a domain name is routing can be quite difficult. To help everyone, we've created a tool that performs the necessary lookups that check where a domain name is routing, and it graphically displays this information for easy review.

Please enter a domain name below and click submit to see where your domain's website and email traffic is being routed to on the internet. Want to see some cool examples, try the following! BETA! Apache 2 on Debian 7 (Wheezy. This tutorial explains how to install and configure the Apache web server on Debian 7 (Wheezy).

Apache 2 on Debian 7 (Wheezy

Note that if you're looking to install a full LAMP stack, you may want to consider using our LAMP guide for Debian 6. Make sure you've followed the Getting Started guide.As part of the Getting Started guide, make sure you set the hostname for your server. Issue the following commands to make sure your hostname is set properly: hostname hostname -f The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN). All of the commands in this article should be executed either as root or as a user with sudo access.

The following commands install Apache support for server-side scripting in PHP, Ruby, Python, and Perl. To install Ruby support, issue the following command: apt-get install libapache2-mod-ruby To install Perl support, issue the following command: apt-get install libapache2-mod-perl2 To install Python support, issue the following command: Note. Hosting multiple websites with Apache2. Posted by Steve on Thu 6 Jul 2006 at 22:03 One of the most common Apache2 questions I've seen on Debian mailing lists is from users who wonder how to host multiple websites with a single server.

Hosting multiple websites with Apache2

This is very straightforward, especially with the additional tools the Debian package provides. We've previously discussed some of the tools which are included in the Apache2 package , but what we didn't do was show they're used from start to finish. There are many different ways you can configure Apache to host multiple sites, ranging from the simple to the complex.