هاست لینوکس

آخرین بسته‌ی MyBB: نسخه‌ی 1.8.27 MyBB منتشر شد


امتیاز موضوع:
  • 0 رأی - میانگین امتیازات: 0
  • 1
  • 2
  • 3
  • 4
  • 5
بهترین کد برای .htaccess چیه
#4
آدرس‌ها رو درست معرفی کنید مطمئناً جواب خواهید گرفت

کد:
# BEGIN .htaccess Security
<files ".htaccess">
order allow,deny
deny from all
</files>
# END .htaccess Security

# BEGIN Indexs Security
Options All -Indexes
# END Indexs Security

# BEGIN Pass The Default Character Set
AddDefaultCharset utf-8
# END Pass The Default Character Set

# BEGIN Error Files
ErrorDocument 401 /error/401.php
ErrorDocument 403 /error/403.php
ErrorDocument 404 /error/404.php
ErrorDocument 500 /error/500.php
# END Error Files

# BEGIN Limit GET POST
<Limit GET POST>
order allow,deny
deny from 200.49.176.139
allow from all
</Limit>
# END Limit GET POST

# BEGIN Limit Spam
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*weho.ir* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
# END Limit Spam

# BEGIN Remove Category
RewriteRule ^category/(.+)$ http://www.yourblog.com/$1 [R=301,L]
# END Remove Category

# BEGIN Change .php to .html
DirectoryIndex file.php file.html
# END Change .php to .html

# BEGIN Disable WWW
RewriteEngine On
RewriteCond %{HTTP_HOST} !^yoursite\.com$ [NC]
RewriteRule ^(.*)$ http://yoursite.com/$1 [R=301,L]
# END Disable WWW

# BEGIN Enable WWW
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# END Enable WWW

# BEGIN Config Security
<files inc/config.php>
order allow,deny
deny from all
</files>
# END Config Security

# BEGIN New Formats
AddType application/x-httpd-php .asp .jsp
AddType text/html .shtml
AddHandler server-parsed .shtml
Options Indexes FollowSymLinks Includes
# END New Formats

# BEGIN Redirect
Redirect /Dirold/old.html http://site.com/DirNew/new.html
# END Redirect

# BEGIN Limit FollowSymlinks
Options +FollowSymlinks
RewriteEngine On
Rewritecond %{REQUEST_FILENAME} !^(.+).css$
Rewritecond %{REQUEST_FILENAME} !^(.+).js$
Rewritecond %{REQUEST_FILENAME} !file.php$
RewriteRule ^(.+)$ /deny/ [nc]
# END Limit FollowSymlinks

# BEGIN Limit Upload Max
php_value upload_max_filesize 40M
# END Limit Upload Max

# BEGIN Limit Upload Post
php_value post_max_size 4M
# END Limit Upload Post

# BEGIN Limit Request Time
php_value max_execution_time 200
# END Limit Request Time

# BEGIN Limit Get & Post
php_value max_input_time 250
# END Limit Get & Post

# BEGIN Images Security
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?site.com/ .*$ [NC]
RewriteRule \.(gif|jpg|swf|flv|png)$ /feed/ [R=302,L]
# END Images Security

# BEGIN Plugins Security
RewriteEngine On
RewriteBase /
RewriteRule ^inc/plugins - [F,L]
RewriteRule !^inc/plugins - [S=3]
RewriteRule ^inc/plugins/[^/]+\.php$ - [F,L]
RewriteRule ^inc/plugins/.+\.php - [F,L]
RewriteRule ^inc/plugins/ - [F,L]
# END Plugins Security

# BEGIN Compress Text Files
<ifModule mod_deflate.c>
<filesMatch "\.(css|js|x?html?|php|woff|ttf|png|jpg|gif)$">
SetOutputFilter DEFLATE
</filesMatch>
</ifModule>
# END Compress Text Files

# BEGIN Expire Headers
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/x-javascript "access plus 1 year"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
ExpiresByType font/ttf "access plus 1 year"
ExpiresByType font/woff "access plus 1 year"
</ifModule>
# END Expire Headers

# BEGIN Cache Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf|woff|ttf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "max-age=2592000, private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
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
پاسخ


پیام‌های داخل این موضوع
بهترین کد برای .htaccess چیه - توسط hasan2014 - ۱۳۹۳/۱۱/۲۵، ۱۱:۱۷:۲۱ صبح
RE: بهترین کد برای .htaccess چیه - توسط R. Najafi - ۱۳۹۳/۱۱/۲۵، ۱۳:۲۸:۱۳ عصر
RE: بهترین کد برای .htaccess چیه - توسط hasan2014 - ۱۳۹۳/۱۱/۲۵، ۱۴:۱۰:۴۷ عصر
RE: بهترین کد برای .htaccess چیه - توسط BamikMarket - ۱۴۰۰/۷/۱۵، ۱۶:۱۴:۴۳ عصر
RE: بهترین کد برای .htaccess چیه - توسط firstboy000 - ۱۴۰۰/۷/۲۲، ۲۳:۴۲:۳۸ عصر

پرش به انجمن:


کاربرانِ درحال بازدید از این موضوع: 1 مهمان