background preloader

-_-

Facebook Twitter

10 useful .htaccess snippets to have in your toolbox. .htaccess, the file which control the Apache webserver, is very useful and allows you to do a lot of things.

10 useful .htaccess snippets to have in your toolbox

In this article, I have compiled 10 .htaccess snippets that any web developer should have in his toolbox. Before editing your .htaccess file, always make a backup so you can restore it if needed. Remove www in url For SEO reasons, you might always remove (or use) the www prefix in your urls. The following snippet will remove the www from your website url and redirect any url with the www to the non-www version.

RewriteEngine On RewriteCond %{HTTP_HOST} ! Source: Prevent hotlinking Hotlinking is a bad practice that consist of using the images from another site on yours. Source: Redirect all WordPress feeds to feedburner Most bloggers are using Feedburner, a web service that lets you know how many people are reading your blog via feeds. <IfModule mod_alias.c> RedirectMatch 301 /feed/(atom|rdf|rss|rss2)/? Source: Create custom error pages Tired of the old errors pages of your site?

Lucene - Apache Solr. Apache Lucene - Apache Lucene Core. Apache LuceneTM is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform. Apache Lucene is an open source project available for free download. Please use the links on the right to access Lucene. Lucene offers powerful features through a simple API: Scalable, High-Performance Indexing over 150GB/hour on modern hardwaresmall RAM requirements -- only 1MB heapincremental indexing as fast as batch indexingindex size roughly 20-30% the size of text indexed Powerful, Accurate and Efficient Search Algorithms Cross-Platform Solution Available as Open Source software under the Apache License which lets you use Lucene in both commercial and Open Source programs100%-pure JavaImplementations in other programming languages available that are index-compatible The Apache Software Foundation.

Apache HTTP Server Project. Apache Virtual Host documentation - Apache HTTP Server Version 2.4. The term Virtual Host refers to the practice of running more than one web site (such as company1.example.com and company2.example.com) on a single machine.

Apache Virtual Host documentation - Apache HTTP Server Version 2.4

Virtual hosts can be "IP-based", meaning that you have a different IP address for every web site, or "name-based", meaning that you have multiple names running on each IP address. The fact that they are running on the same physical server is not apparent to the end user. Apache was one of the first servers to support IP-based virtual hosts right out of the box. Versions 1.1 and later of Apache support both IP-based and name-based virtual hosts (vhosts). The latter variant of virtual hosts is sometimes also called host-based or non-IP virtual hosts.

Below is a list of documentation pages which explain all details of virtual host support in Apache HTTP Server: Configuration directives If you are trying to debug your virtual host configuration, you may find the Apache -S command line switch useful. /usr/local/apache2/bin/httpd -S. Apache HTTP Server Tutorial: .htaccess files - Apache HTTP Server Version 2.4. Apache Performance Tuning - Apache HTTP Server Version 2.4. Apache 2.x is a general-purpose webserver, designed to provide a balance of flexibility, portability, and performance.

Apache Performance Tuning - Apache HTTP Server Version 2.4

Although it has not been designed specifically to set benchmark records, Apache 2.x is capable of high performance in many real-world situations. Compared to Apache 1.3, release 2.x contains many additional optimizations to increase throughput and scalability. Most of these improvements are enabled by default. However, there are compile-time and run-time configuration choices that can significantly affect performance. This document describes the options that a server administrator can configure to tune the performance of an Apache 2.x installation.

Hardware and Operating System Issues The single biggest hardware issue affecting webserver performance is RAM. Beyond that the rest is mundane: get a fast enough CPU, a fast enough network card, and fast enough disks, where "fast enough" is something that needs to be determined by experimentation. Security Tips - Apache HTTP Server Version 2.4. Some hints and tips on security issues in setting up a web server.

Security Tips - Apache HTTP Server Version 2.4

Some of the suggestions will be general, others specific to Apache. Keep up to Date The Apache HTTP Server has a good record for security and a developer community highly concerned about security issues. But it is inevitable that some problems -- small or large -- will be discovered in software after it is released. For this reason, it is crucial to keep aware of updates to the software. Of course, most times that a web server is compromised, it is not because of problems in the HTTP Server code. Denial of Service (DoS) attacks All network servers can be subject to denial of service attacks that attempt to prevent responses to clients by tying up the resources of the server. Often the most effective anti-DoS tool will be a firewall or other operating-system configurations.

There are also certain Apache HTTP Server configuration settings that can help mitigate problems: Permissions on ServerRoot Directories CGI in General. Apache Tomcat. Hadoop.