.htaccess tutorial

htaccess Elite


any one help me to set up htaccess file

Using PHP in and with htaccess

any one help me to set up htaccess file

New postby mizanur » 21 Feb 2009 17:11

Hello,
when I install php and cgi script.its not work in with htaccess file. If I remove it then work it fine.i got error message 500 So any one help me to set up htaccess file. Here is my htaccess file currently using:



#================================================= =======#
# MAIN SETTINGS AND OPTIONS
#================================================= =====#
# Options: ALL,FollowSymLinks,Includes,IncludesNOEXEC,SymLink sIfOwnerMatch
###########


### MAIN DEFAULTS ###
Options +ExecCGI -Indexes
DirectoryIndex index.html index.htm index.php
DefaultLanguage en-US
AddDefaultCharset UTF-8
ServerSignature Off

### ENVIRONMENT VARIABLES ###
#SetEnv PHPRC /webroot/includes
#SetEnv TZ America/Indianapolis
SetEnv SERVER_ADMIN mailto:webmaster@business2workathome.com


### MIME TYPES ###
AddType video/x-flv .flv
AddType application/x-shockwave-flash .swf
AddType image/x-icon .ico


### FORCE FILE TO DOWNLOAD INSTEAD OF APPEAR IN BROWSER ###
#
AddType application/octet-stream .mov .mp3 .zip




#================================================#
# HEADERS, CACHING AND OPTIMIZATION
#================================================= =
#-> htacces...ders-vt65.html
# 300 5 M
# 2700 45 M
# 3600 1 H
# 54000 15 H
# 86400 1 D
# 518400 6 D
# 604800 1 W
# 1814400 3 W
# 2419200 1 M
# 26611200 11 M
# 29030400 1 Y (never expire)
###########



### ALTERNATE EXPIRES CACHING ###
#
ExpiresActive On
ExpiresDefault A604800
ExpiresByType image/x-icon A2592000
ExpiresByType application/x-javascript A2592000
ExpiresByType text/css A2592000
ExpiresByType text/html A300
<FilesMatch "\\.(pl|php|cgi|spl|scgi|fcgi)$">
ExpiresActive Off
</FilesMatch>


### META HTTP-EQUIV REPLACEMENTS ###
#<FilesMatch "\\.(html|htm|php)$">
# Header set imagetoolbar "no"
#</FilesMatch>







#================================================= ==#
# REWRITES AND REDIRECTS
#===============================================#
# REQUEST METHODS: GET,POST,PUT,DELETE,CONNECT,OPTIONS,PATCH,PROPFIND ,
# PROPPATCH,MKCOL,COPY,MOVE,LOCK,UNLOCK
###########


### REWRITE DEFAULTS ###
#RewriteEngine On
#RewriteBase /


### SEO REWRITES ###
#RewriteRule ^(.*)/ve/(.*)$ $1/voluntary-employee/$2 [L,R=301]
#RewriteRule ^(.*)/hsa/(.*)$ $1/health-saving-account/$2 [L,R=301]


### WORDPRESS ###
#RewriteCond %{REQUEST_FILENAME} !-f # Existing File
#RewriteCond %{REQUEST_FILENAME} !-d # Existing Directory
#RewriteRule . /index.php [L]


### ALTERNATIVE ANTI-HOTLINKING ###
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?business2workathome.com/.*$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?freemoneyonlinesite.com/.*$
RewriteRule \.(gif|jpg|jpeg|js|css)$ - [F]


### REDIRECT HOTLINKERS ###
#RewriteCond %{HTTP_REFERER} !^$
#RewriteCond %{HTTP_REFERER} !^http://(www.)?business2workathome.com/.*$ [NC]
#RewriteRule ^.*\\.(bmp|tif|gif|jpg|jpeg|jpe|png)$ http://google.com [R]


### DENY REQUEST BASED ON REQUEST METHOD ###
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK|OPTIONS|HEAD)$ [NC]
RewriteRule ^.*$ - [F]



#### ALTERNATATIVE TO USING ERRORDOCUMENT ###
#
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^.*$ /error.php [L]




#================================================= ============================#
# AUTHENTICATION AND SECURITY
#================================================= ============================#
#
#
# Require (user|group|valid-user) (username|groupname)
###########


### BASIC PASSWORD PROTECTION ###
AuthType basic
AuthName "prompt"
AuthUserFile /.htpasswd
AuthGroupFile /dev/null
Require valid-user


### ALLOW FROM IP OR VALID PASSWORD ###
Require valid-user
#Allow from 192.168.1.23
Satisfy Any


### PROTECT FILES ###
<FilesMatch "\\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh )$">
Order Allow,Deny
Deny from all
</FilesMatch>
mizanur
 
Posts: 1
Joined: 21 Feb 2009 17:01

Return to PHP and htaccess