Cách tạo mạng nội bộ cho doanh nghiệp nhỏ bằng WordPress

Thông thường, một hệ thống CNTT văn phòng được kết nối qua bộ điều hợp mạng không dây hoặc cáp. Một máy tính trên mạng có thể được sử dụng làm máy chủ web và lưu trữ một trang web WordPress.

Để tạo extranet WordPress của mình, bạn cần có tài khoản hosting WordPress và tên miền. Sau đó, bạn có thể cài đặt WordPress rồi thiết lập nó để được sử dụng làm mạng nội bộ của tổ chức bạn.

1. Thiết lập BuddyPress làm Trung tâm mạng nội bộ WordPress của bạn

Để bắt đầu trước tiên bạn cần cài đặt và kích hoạt plugin BuddyPress. Sau khi kích hoạt, hãy chuyển đến Cài đặt » trang BuddyPress để định cấu hình cài đặt plugin.

2. Bảo vệ mạng nội bộ?

Để bảo mật tốt hơn hết là bạn cài plugin All in one Intranet. Sau khi kích hoạt, hãy truy cập trang Setting »All- In- One Intranet để cấu hình cài đặt plugin.

 

Các bạn tích chọn vào hộp Fore site to be entirely private .

3. Bảo mật Media Uploads trên mạng nội bộ WordPress

Tạo một file sau đó upload lên / wp-content / uploads / folder với nội dung

<?php
require_once('wp-load.php');
is_user_logged_in() ||  auth_redirect();
list($basedir) = array_values(array_intersect_key(wp_upload_dir(), array('basedir' => 1)))+array(NULL);
$file =  rtrim($basedir,'/').'/'.str_replace('..', '', isset($_GET[ 'file' ])?$_GET[ 'file' ]:'');
if (!$basedir || !is_file($file)) {
    status_header(404);
    die('404 — File not found.');
}
$mime = wp_check_filetype($file);
if( false === $mime[ 'type' ] && function_exists( 'mime_content_type' ) )
    $mime[ 'type' ] = mime_content_type( $file );
if( $mime[ 'type' ] )
    $mimetype = $mime[ 'type' ];
else
    $mimetype = 'image/' . substr( $file, strrpos( $file, '.' ) + 1 );
header( 'Content-Type: ' . $mimetype ); // always send this
if ( false === strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS' ) )
    header( 'Content-Length: ' . filesize( $file ) );
$last_modified = gmdate( 'D, d M Y H:i:s', filemtime( $file ) );
$etag = '"' . md5( $last_modified ) . '"';
header( "Last-Modified: $last_modified GMT" );
header( 'ETag: ' . $etag );
header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 100000000 ) . ' GMT' );
// Support for Conditional GET
$client_etag = isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ? stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) : false;
if( ! isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) )
    $_SERVER['HTTP_IF_MODIFIED_SINCE'] = false;
$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] );
// If string is empty, return 0. If not, attempt to parse into a timestamp
$client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0;
// Make a timestamp for our most recent modification...
$modified_timestamp = strtotime($last_modified);
if ( ( $client_last_modified && $client_etag )
    ? ( ( $client_modified_timestamp >= $modified_timestamp) && ( $client_etag == $etag ) )
    : ( ( $client_modified_timestamp >= $modified_timestamp) || ( $client_etag == $etag ) )
    ) {
    status_header( 304 );
    exit;
}
readfile( $file );
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^wp-content/uploads/(.*)$ download-file.php?file=$1[QSA,L]

Tiếp theo, bạn cần chỉnh sửa tệp .htaccess trong thư mục gốc của trang web- Thêm mã sau vào cuối tệp .htaccess của bạn

RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^wp-content/uploads/(.*)$ download-file.php?file=$1[QSA,L]
OK như vậy là mình đã hướng dẫn xong cho các bạn cách tạo mạng nội bộ WordPress cho tổ chức của mình.
* Bonus:
  • Sucuri – Để cải thiện bảo mật WordPress bằng cách bảo vệ khỏi các cuộc tấn công DDoS độc hại.
  • Envira Gallery – Để tạo các thư viện ảnh đẹp.
  • Google Drive Embedder – Dễ dàng nhúng tài liệu Google Drive vào bất kỳ đâu trong mạng nội bộ WordPress.

Leave a Reply