====== Apache ====== Welcome to the world wide web! * [[Apache Benchmarks]] * [[Apache Error Documents]] * [[Apache Logs]] * [[Apache mod_fcgid]] * [[Apache mod_rewrite]] * [[Apache mod_wsgi]] * [[Apache MPM Prefork]] * [[Apache MPM Worker]] * [[Apache Options Directive]] * [[Apache Security]] * [[Apache Server Info]] * [[Apache SSL]] * [[Apache SuExec]] * [[Apache Tuning]] * [[Apache Virtual Hosts]] * [[CentOS Apache]] * [[FreeBSD Apache]] * [[OpenBSD Apache]] * [[Gentoo Apache]] * [[PCI Compliance]] * [[htaccess]] * [[mod_pagespeed]] * [[http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html|Apache mod_proxy_balancer]] * [[http://www.htaccessredirect.co.uk/|.htaccess Redirect]] ===== Configuration Files ===== * /etc/apache2/httpd.conf - Main apache configuration. Includes module configurations using Include directive. * /etc/apache2/modules.d/*.conf - Modules configuration files * /etc/apache2/vhosts.d/*.conf - VirtualHosts configuration files ===== Howtos ===== == Redirect site to HTTPS == RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} == Redirect all non-domain names to the domain == RewriteEngine On RewriteCond %{HTTP_HOST} !^www.domain.com RewriteRule (.*) http://www.domain.com$1 [R=301,L] == Redirect non-www prefix for a domain to www == RewriteCond %{HTTP_HOST} ^example.com RewriteRule (.*) http://www.example.com/$1 [R=301,L] == Rewrite if REQUEST_URI matches string == You can use Perl regular expression syntax with RewriteCond RewriteEngine On RewriteCond %{REQUEST_URI} ^/(dmc)?wiki RewriteRule ^(.*)$ https://wiki.digitaltrike.com/$1 == Allow access from subnet only == Order Deny,Allow Deny from all Allow from 192.168.1.0/24 == List modules == CentOS: apachectl -t -D DUMP_MODULES == Disable any caching on 192.168.12. subnet == SetEnvIf Remote_Addr 192\.168\.12\. local Header set Pragma "" env=local Header set Cache-Control "" env=local Header set Expires "Sat, 01 Jan 2000 00:00:00 GMT" env=local == Enable PHP overrides in .htaccess == If PHP is installed as a CGI binary, this will not work. But it is safe to set because of ''IfModule''. php_value include_path ".:/usr/local/lib/php"