هاستینگ میهن وب سرور
« جهت سفارش تبلیغات اینجا کلیک کنید »
رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
بهینه سازی و افزایش نسبی امنیت وردپرس
#1
Lightbulb 
بهینه سازی نسبی و افزایش نسبی امنیت وردپرس با استفاده از چند خط کد


1- کدهای زیر را در فایل wp-config.php اضافه کنید:
کد:
// Change the Post Auto-Save Interval
define('AUTOSAVE_INTERVAL', 300 ); // seconds

// Limit Post Revisions in WordPress. Alternatively, if you would like to Disable Post Revisions function, change the 3 to false
define( 'WP_POST_REVISIONS', 3);

// Disable File Editing inside WordPress
define( 'DISALLOW_FILE_EDIT', true );



2- کدهای زیر را در فایل functions.php قالب خود اضافه کنید:
کد:
// Hide Errors on the WordPress Login screen
function no_errors_please() {
  return 'Error';
}
add_filter( 'login_errors', 'no_errors_please' );

// Stop WordPress from Guessing URLs
add_filter('redirect_canonical', 'stop_guessing');
function stop_guessing($url) {
if (is_404()) {
   return false;
}
return $url;
}

// To remove the version number and other non-essential meta-data from your WordPress header
remove_action( 'wp_head', 'wp_generator' ) ;
remove_action( 'wp_head', 'rsd_link' ) ;

// Windows Live Writer users who do not use the live preview feature may turn off this function
remove_action( 'wp_head', 'wlwmanifest_link' ) ;

// Disable HTML in WordPress comments
add_filter( 'pre_comment_content', 'wp_specialchars' );

// Hide the secondary WordPress feeds
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );



3- کدهای زیر را در فایل .htaccess اضافه کنید:
کد:
# Set Expiry Headers for Static Content
ExpiresActive On
ExpiresByType image/gif "access plus 30 days"
ExpiresByType image/jpeg "access plus 30 days"
ExpiresByType image/png "access plus 30 days"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"

# Prevent people from browsing your WordPress folder structure
Options All -Indexes

# Redirect all feeds to your master RSS feed
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC]
RewriteRule ^feed/?.*$ http://feeds.labnol.org/labnol [L,NC,R=301]
</IfModule>

# Hide your XML Sitemaps from Search Engines
# XML Sitemaps will help search engines better crawl your site but you don’t want to search engines to actually show your sitemap in search results pages
<IfModule mod_rewrite.c>
<Files sitemap.xml>
  Header set X-Robots-Tag "noindex"
</Files>
</IfModule>

# Remove extra Query Parameters from URLs, like get.php?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} !=""
RewriteCond %{QUERY_STRING} !^p=.*
RewriteCond %{QUERY_STRING} !^s=.*
RewriteCond %{REQUEST_URI} !^/wp-admin.*
RewriteRule ^(.*)$ /$1? [R=301,L]
</IfModule>

# protect wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>


در صورت نیاز یا بروز مشکل، توضیح کوتاهی بر روی هر کد به انگلیسی درج شده.

! قبل از ارسال سوال ابتدا جستجو کنید، اگر تاپیک مرتبط وجود ندارد، در بخش مناسب یک تاپیک جدید ایجاد کنید !

* به سوالات عمومی در تلگرام یا پیام خصوصی پاسخی ارسال نخواهد شد! *
پاسخ


موضوعات مشابه ...
موضوع نویسنده پاسخ بازدید آخرین ارسال
Star افزایش امنیت فایل wp-config.php در وردپرس Admin 0 5,163 2013-12-08, 18:16
آخرین ارسال: Admin

پرش به انجمن:


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