Vi?c website WordPress b? dnh m ??c b?i vi?c s? d?ng theme/plugin khng r ngu?n g?c (n?u khng mu?n ni l dng l?u) ho?c ??t m?t kh?u ??n gi?n d? ?on l chuy?n qu ??i bnh th??ng c?a chng ta.

Hi?n nay khi website b? dnh m ??c th th??ng l c 3 k?ch b?n th??ng g?p nh? sau:

  1. Trang ch? b? ??i thnh m?t trang c?nh bo l ?b? hackkm theo nh?c honh trng.
  2. Website m th?m g?i ?i cc email l?a ??o, spam lin t?c trn host m ch? nhn khng h? hay bi?t.
  3. Website ch?a cc ???ng lin k?t ?n qu?ng co cc d?ch v? thu?c kch d?c, c? b?c, phishing scam.

V khi website b?n b? r?i vo cc tr??ng h?p ny, cc nh cung c?p Hosting s? kha l?i. N?u b?n dng VPS th s? b? c?nh bo ho?c kha n?u r?i vo k?ch b?n s? 1 v tn mi?n b? r?i vo s? ?en khng s?m c?ng mu?n, lc ny website s? b? t?t th? h?ng ? my tm ki?m, khi truy c?p b?ng Google Chrome s? c c?nh bo mu ?? r?ng website ny r?t nguy hi?m.

Th? nh?ng ?? website khng b? hack c?ng khng ph?i kh, ch? c?n b?n dng s?n ph?m c b?n quy?n ??y ??, ??t m?t kh?u ph?c t?p (l?u v Lastpass ch?ng h?n) v thi?t l?piThemes Securityl ???c. N?u b?n dng Hosting th nn ch?n cc ??n v? cung c?p hosting s? d?ng CloudLinux nh?AZDIGI,StableHost,A2Hosting, Hawkhost,m s? d?ng ?? trnh b? nhi?m m ??c t? anh b?n hng xm.

CHNG TA LM G KHI WEBSITE B? HACK?

Chng ta hay ln cc trang m?ng h?i cng c? qut m ??c khi b? r?i vo cc tr??ng h?p ny, th? nh?ng tin bu?n dnh cho b?n l khng c cng c? no gip b?n g? m ??c mi?n ph c?, mnh th? ??y. Ch? duy nh?t c 1 d?ch v? g? m ??c m mnh bi?t v s? d?ng qua r?i ? lSucuriAntivirusv?i gi r?t ??t ?? v b?n ph?i ch?p nh?n n?u c?n g? m ??c hon ton. Th? nh?ng sau khi g? xong, ch?a ch?c website ? th?t s? s?ch s? m ch? duy nh?t c 1 cch: Ci l?i t? ??u.

Ci website l?i t? ??u l cch duy nh?t c?ng l t?t nh?t ?? website c?a b?n tr? nn s?ch s?. Ci website l?i khng c ngh?a l b?n s? vi?t l?i n?i dung hay s?n ph?m v cc d? li?u ny s? l?u v database, nh?ng tin vui l khng c m ??c no ?nh km v database c?a b?n c?. Ci website l?i ngh?a l chng ta s? l?y d? li?u m?m l?u trong database ? website c?, sau ? ci website m?i v nh?p cc d? li?u ny vo, r?i ci l?i plugin v theme t? ??u v?i ngu?n g?c r rng h?n.

Trong bi vi?t ny, mnh s? h??ng d?n b?n chi ti?t cch lm vi?c ny.

CC B??C CI L?I WEBSITE T? ??U

B??c 1. Ci m?i website

By gi? b?n hy ti?n hnh ci ??t m?t website WordPress m?i trn host ho?c localhost v s? d?ng m?t tn mi?n khc ?? ch?y website ny nh?m ??m b?o b?n v?a truy c?p vo website m?i v c? website c? ?? ti?n ki?m tra, ??i chi?u.

Sau ? m? t?p tin wp-config.php c?a website m?i v chn ?o?n sau vo d??i <?php:

01
02
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Thay example.com thnh ??a ch? c?a website m?i nh.

B??c 2. Backup d? li?u ? website c?

??u tin hy truy c?p phpMyAdmin ?? export d? li?u c?a database website ?ang s? d?ng ra v t?i v? my. N?u host b?n khng c phpMyAdmin, th c th? dng pluginBackWPUp?? backup database v t?i v?, ch? c?n database thi nh.

K? ti?p l hy mang cc th? m?c ch?a hnh ?nh upload trong /wp-content/uploads/ nh? 2017, 2016, 2015, 2014,v? my. L?u l ch? cc th? m?c ch?a hnh ?nh upload, cc th? m?c khc khng c?n l?y v? ?? ??m b?o an ton. N?u b?n dng Hosting th c th? vo File Manager dng tnh n?ng Compress ?? nn cc th? m?c ny l?i v t?i v?. Ho?c n?u b?n ci website m?i trn cng host th khng c?n t?i m ch? c?n copy d? li?u cc th? m?c ny vo /wp-content/uploads/ ? th? m?c website m?i.

B??c 3. Nh?p d? li?u c? vo website m?i

By gi? b?n hy truy c?p vo phpMyAdmin t?i host (ho?c localhost) ?ang ch?y website m?i v tm tn database c?a website ?, sau ? ?n Nh?p (Import) v t?i ln t?p tin .sql m b?n c ???c ? b??c 1.

L?i khi import databaseN?u b?n g?p l?i khi import database th hy t?o m?t database m?i hon ton v import vo database m?i. Sau ? thi?t l?p website s? d?ng database m?i nh.

Sau khi nh?p xong, b?n hy xem tn b?ng d? li?u c ti?n t? lwp_hay m?t ti?n t? khc. N?u b?n s? d?ng tn ti?n t? khc v?iwp_th hy m? t?p tinwp-config.php? website m?i, tm$table_prefixv thaywp_thnh ti?n t? c?a b?ng database. V d? mnh c b?ng tn38dug_optionstrong c? s? d? li?u th s? thay thnh:

01
$table_prefix='38dug_';

Sau ? hy t?i cc th? m?c hnh ?nh trong website c? ?ang ch?y trn host (wp-content/uploads) vo th? m?c wp-content/uploads ? website m?i ?? ??m b?o hnh ?nh khng b? m?t.

?? ki?m tra, b?n c th? truy c?p vo ph?n Media Library trn website m?i ?? xem ? c hi?n th? hnh ?nh ??y ?? hay ch?a. N?u hnh ?nh hi?n th? ra bnh th??ng th ? hon t?t.

B??c 4. Ci l?i theme an ton h?n

By gi? b??c cn l?i c?a b?n l hy ci l?i theme trn website. N?u b?n dng theme tr? ph th t?t nh?t nn mua b?n quy?n theme ? ?? ??m b?o h?n, ???c c?p nh?t phin b?n m?i th??ng xuyn n?u c l? h?ng b?o m?t x?y ra.

V? b??c ny ch?c mnh khng c?n ni qua r?i, khici themen?u theme ? yu c?u ci thm plugin g b?n c th? ci vo v cc plugin ?i theo theme c?ng r?t ??m b?o nn b?n c th? hon ton yn tm.

B??c 5. Upload m ngu?n vo website chnh

Khi b?n ? thi?t l?p website hon t?t v b?t ??u s? d?ng. Hy ti?n hnh truy c?p vo website c? v xa ton b? d? li?u trn host ?i, sau ? chuy?n m ngu?n c?a website b?n m?i lm ln host vo th? m?c c?a website chnh. V? b??c ny, b?n lm gi?ng nh? vi?c chuy?n host c?a m?t website bnh th??ng bao g?m 2 b??c:

  1. Backup v khi ph?c m ngu?n website m?i ln host.
  2. Backup database v khi ph?c database trn host.

Sau khi chuy?n hon t?t, hy m? t?p tin wp-config.php c?a website m?i trn host v s?a l?i WP_HOME, WP_SITEURL thnh ??a ch? website chnh. V d?:

01
02
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

Vi?c ny s? ??m b?o b?n c th? truy c?p vo website m?i theo tn mi?n chnh c?a website.

B??c 6. Thay ??a ch? website trong database

By gi? b?n hy ??ng nh?p vo website m?i trn host vci pluginBetter Search Replace, sau ? vo m?c Tools -> Better Search Replace v tm tn mi?n c? trong t?t c? b?ng database v ??i sang tn mi?n m?i, b? ch?nRun as dry run nh? hnh d??i.

Nh? v?y t?t c? cc lin k?t trong website ?ang s? d?ng tn mi?n c? s? ???c ??i thnh tn mi?n m?i m khng c?n ph?i lm th? cng.

B??c cu?i. Thi?t l?p b?o m?t cho website WordPress

Ngay sau khi website ? ho?t ??ng hon t?t, hy ti?n hnh thi?t l?p b?o m?t cho website.

V quan tr?ng nh?t l khng s? d?ng cc plugin/theme ???c chia s? khng r ngu?n g?c v ?i?u ny l nguyn nhn c?a 90% tr??ng h?p b? m ??c m mnh t?ng bi?t ??n. N?u b?n khng ci ci g l? vo website, m?t kh?u qu?n tr? ph?c t?p, thi?t l?p plugin b?o m?t t?t th b?n s? khng c?n quan tm ??n cc gi?i php b?o m?t no n?a.

Chc website c?a b?n s?m ???c ph?c h?i v ho?t ??ng ?n ??nh.

Ngu?n : thachpham.com