|
HtAccess
Default .htaccess file
.htaccessDoc here : http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html URL rewritingRewriteEngine on
#RewriteBase /
#php_value memory_limit "99M"
#php_value post_max_size "99M"
#php_value upload_max_filesize "99M"
ErrorDocument 404 /404.php
# COMPRESS
#RewriteRule ^css/(.*\.css) cache.php?type=css&files=$1
#RewriteRule ^js/(.*\.js) cache.php?type=javascript&files=$1
# DYN REDIR
RewriteRule ^([a-z,-]+)-r([0-9]+).html(.*)$ index.php?rid=$2$3 [QSA,L]
RewriteRule ^([a-z,-]+)-r([0-9]+).html$ index.php?rid=$2 [L]
RewriteRule ^([a-z,-]+)-r([0-9]+)-a([0-9]+).html$ index.php?rid=$2&article_id=$3$4 [QSA,L]
RewriteRule ^([a-z,-]+)-r([0-9]+)-p([0-9]+).html$ index.php?rid=$2&page=$3$4 [QSA,L]
# Redirecting non www URL to www URL
RewriteCond %{HTTP_HOST} ^seo\.com$
RewriteRule (.*) http://www.seo.com/$1 [R=301,L]
# If file not exists condition
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule ^([^.]+)\.s?html$ /app.php?file=$1 [L,R=301]
Restriction d'acceshttp://httpd.apache.org/docs/2.0/howto/auth.html 1/ en ligne de commande # htpasswd -c /home/passwd/ficherMdpACreer nomUtilisateur 2/ dans un .htaccess situé dans le répertoire à protéger (les sous répertoires seront aussi protégés): AuthType Basic AuthName "Restricted Files" AuthUserFile /home/passwd/ficherMdpACreer Require user nomUtilisateur Utilisation avancée avec système de cache<IfModule mod_expires.c> ExpiresActive On ExpiresDefault A86400 ExpiresByType image/x-icon A2419200 ExpiresByType image/gif A604800 ExpiresByType image/png A604800 ExpiresByType image/jpeg A604800 ExpiresByType text/css A604800 ExpiresByType application/x-javascript A604800 ExpiresByType text/plain A604800 ExpiresByType application/x-shockwave-flash A604800 ExpiresByType application/pdf A604800 ExpiresByType text/html A900 # Set up Cache Control headers ExpiresActive On # Default - Set http header to expire everything 1 week from last access, set must-revalidate expiresdefault A604800 Header append Cache-Control: "must-revalidate" # Apply a customized Cache-Control header to frequently-updated files <FilesMatch "^(bulog¦test)\.html$"> expiresdefault A1 Header unset Cache-Control: Header append Cache-Control: "no-cache, must-revalidate" </FilesMatch> <FilesMatch "^index\.htm"> expiresdefault A7200 </FilesMatch> <FilesMatch "^robots\.txt$"> expiresdefault A7200 </FilesMatch> # Infrequent htaccess file <FilesMatch "\.(gif¦jpe?g¦png¦css¦js¦ico¦pdf¦swf¦flv)$"> expiresdefault A604800 </FilesMatch> # Frequent htaccess file <FilesMatch "\.(gif¦jpe?g¦png¦css¦js¦ico¦pdf¦swf¦flv)$"> expiresdefault A604800 Header set cache-control: "no-cache, public, must-revalidate" </FilesMatch> </IfModule> |
► Sign in to add a comment