/ Published in: Apache
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# # DEFAULT SETTINGS # Options ExecCGI -Indexes DirectoryIndex index.php index.html index.htm  ErrorDocument 400 /cgi-bin/error.php ErrorDocument 401 /cgi-bin/error.php ErrorDocument 403 /cgi-bin/forbidden.cgi ErrorDocument 404 /404.html ErrorDocument 405 /cgi-bin/error.php ErrorDocument 406 /cgi-bin/error.php ErrorDocument 409 /cgi-bin/error.php ErrorDocument 413 /cgi-bin/error.php ErrorDocument 414 /cgi-bin/error.php ErrorDocument 500 /cgi-bin/error.php ErrorDocument 501 /cgi-bin/error.php  ### DEFAULTS ServerSignature Off  AddType video/x-flv .flv AddType application/x-shockwave-flash .swf AddType image/x-icon .ico  AddDefaultCharset UTF-8 AddLanguage en-US .html .htm .txt .xml .php  SetEnv TZ America/Indianapolis SetEnv SERVER_ADMIN [email protected]  ### PHPINI-CGI #AddHandler php-cgi .php #Action php-cgi /cgi-bin/php5.cgi  ### FAST-CGI #AddHandler fastcgi-script .fcg .fcgi .fpl #AddHandler php5-fastcgi .php #Action php5-fastcgi /cgi-bin/fastcgi.fcgi  # # HEADERS and CACHING # # 1 YEAR <FilesMatch "\.(flv|ico|pdf)$"> Header set Cache-Control "max-age=29030400, public" </FilesMatch>  # 1 WEEK <FilesMatch "\.(jpg|jpeg|png|gif|swf)$"> Header set Cache-Control "max-age=604800, public" </FilesMatch>  # 3 HOUR <FilesMatch "\.(txt|xml|js|css)$"> Header set Cache-Control "max-age=10800" </FilesMatch>  # 1 MIN <FilesMatch "\.(html|htm|php)$"> Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate" Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"NOI DSP COR NID CUR ADM DEV OUR BUS\"" Header set imagetoolbar "no" </FilesMatch>  # # REWRITES AND REDIRECTS # ### SEO REDIRECTS #Redirect 301 /ssl-ns.html /2006/htaccess/apache-ssl-in-htaccess-examples.html #Redirect 301 /ht.tml #Redirect 301 /index.html / #RedirectMatch 301 /2006/htaccess-forum/(.*) /2006/htaccess/$1 #RedirectMatch 301 /(.*)rfc2616(.*) http://rfc.askapache.com/rfc2616/rfc2616.html #RedirectMatch 301 /phpmanual(.*) /manual/en/$1  ### REWRITES RewriteEngine On RewriteBase /  ### WORDPRESS #<IfModule mod_rewrite.c> #RewriteEngine On #RewriteBase / #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule . /index.php [L] #</IfModule>  ### REQUIRE WWW #RewriteCond %{HTTP_HOST} !^www\.askapache\.com$ [NC] #RewriteRule ^(.*)$ /$1 [R=301,L]  ### STOP LOOP CODE #RewriteCond %{ENV:REDIRECT_STATUS} 200 #RewriteRule ^.*$ - [L]  ### REDIRECT BLOG FEED TO FEEDBURNER #RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator|Recent) [NC] #RewriteRule ^feed/?.*$ http://feeds.feedburner.com/apache/htaccess [L,R=302]  ### BLOCK WGET #RewriteCond %{HTTP_USER_AGENT} ^Wget.* [NC] #RewriteRule .* /cgi-bin/forbidden.cgi [L]  # # AUTHENTICATION # ### BASIC PASSWORD PROTECTION #AuthName "Prompt" #AuthUserFile /home/askapache.com/.htpasswd #AuthType basic #Require valid-user  ### UNDER CONSTRUCTION PROTECTION #AuthName "Under Development" #AuthUserFile /home/askapache.com/.htpasswd #AuthType basic #Require valid-user #Order Deny,Allow #Deny from all #Allow from 23.23.23.1 w3.org googlebot.com google.com google-analytics.com #Satisfy Any
URL: http://www.askapache.com/htaccess/apache-authentication-in-htaccess.html