قسمتهایی از فایل HTACCESS که فکر می کنم باعث مشکل شدن در ادامه قرار دادم. بنظرتون مشکل چیه:
کد PHP:
ErrorDocument 404 /page/p404
ErrorDocument 403 /page/p403
ErrorDocument 500 /page/p500
RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteRule ^folder3/.*$ - [L]
RewriteRule ^folder4/.*$ - [L]
RewriteRule ^sitemap.xml$ folder1/sitemap.php [NC,L]
RewriteRule ^robots.txt$ folder2/robots.php [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
محتویات کامل فایل HTACCESS رو در ادامه نوشتم
کد PHP:
#To privent from file listing in pages that dont have index file
IndexIgnore *
#To add charset
AddDefaultCharset utf-8
<limit put>
order deny,allow
deny from all
</limit>
#privent from FSOCKOPEN
# protect wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>
# disable directory browsing
Options All -Indexes
# STRONG HTACCESS PROTECTION</code>
<Files ~ "^.*\.([Hh][Tt][Aa])">
order allow,deny
deny from all
satisfy all
</Files>
#<Files .htaccess>
#order allow,deny
#deny from all
#</Files>
##############################
# BEGIN Compress text files
<ifModule mod_deflate.c>
<filesMatch "\.(css|js|php|x?html?)$">
SetOutputFilter DEFLATE
</filesMatch>
</ifModule>
# END Compress text files
# BEGIN Expire headers
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
#ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>
# END Expire headers
# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|bmp|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, private"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "max-age=2592000, private"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "max-age=2592000, private"
</filesMatch>
<filesMatch "\.(x?html?)$">
Header set Cache-Control "max-age=600, private, must-revalidate"
</filesMatch>
</ifModule>
# END Cache-Control Headers
# BEGIN Turn ETags Off
<ifModule mod_headers.c>
Header unset ETag
</ifModule>
FileETag None
# END Turn ETags Off
# BEGIN Remove Last-Modified Header
<ifModule mod_headers.c>
Header unset Last-Modified
</ifModule>
# END Remove Last-Modified Header
##############################
#AddType application/x-httpd-php .asp .py .pl
#page not found
ErrorDocument 404 /page/p404
#Access forbidden:
ErrorDocument 403 /page/p403
#Server error
ErrorDocument 500 /page/p500
RewriteEngine On
Options +FollowSymLinks
RewriteBase /
# yes-www
#RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
#RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteRule ^folder3/.*$ - [L]
RewriteRule ^folder4/.*$ - [L]
RewriteRule ^sitemap.xml$ folder1/sitemap.php [NC,L]
RewriteRule ^robots.txt$ folder1/robots.php [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
#to privent from <script> tags
#RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
#RewriteRule ^(.*)$ index.php [F,L]
#################################################
#To privent from load your pics in other wweb sites
#RewriteCond %{HTTP_REFERER} !^$
#RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
#RewriteRule \.(gif|jpg|jpeg|png|bmp|swf|flv)$ - [F]
#To show your pic in the sites which load your sites
#RewriteCond %{HTTP_REFERER} !^$
#RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
#RewriteRule \.(gif|jpg|jpeg|png|bmp|swf|flv)$ http://www.mydomain.com/badimage.gif [R,L]
#################################################