Chuyển đổi cấu trúc Permalink của WordPress trong Ubuntu

Đối với những người sử dụng dịch vụ WordPress, việc thay đổi cấu trúc permalink (đường dẫn URL trỏ tới 1 bài viết cụ thể nào đó trong blog hoặc forum) thành 1 dạng nào đó dễ nhìn và đọc hơn đối với mọi người so với dạng mặc định ?p=123. Và 1 ý kiến được cộng đồng WordPress đề xuất và sử dụng rộng rãi là cài đặt thêm plugin Permalinks Migration. Tuy nhiên, nếu không cài đặt và cấu hình đúng cách thì plugin sẽ không hoạt động và gây ra lỗi HTTP 404 Error Message. Trong bài viết sau, Quản Trị Mạng sẽ hướng dẫn các bạn cách khắc phục hiện tượng này.
Đầu tiên, cài đặt và kích hoạt plug-in như bình thường.
Chọn AdminPanel -> Options -> PermalinksMigration và thiết lập cấu trúc cũ của website đang sử dụng, trong trường hợp này chúng ta sử dụng cấu trúc mặc định, do đó điền /%post_id%/
Tiếp theo, tại AdminPanel -> Options -> Permalinks và thay đổi cấu trúc này về bất cứ dạng nào bạn muốn, với nhiều nguồn và nhiều gợi ý khác nhau từ cộng đồng mạng, cùng với tính năng tối ưu hóa bộ máy tìm kiếm - Search engine optimization (SEO), chúng ta sẽ sử dụng dạng /%postname%-%post_id%.html/
Đối với các plugin khác, thì chỉ cần thay đổi tham số kỹ thuật tương ứng về đúng dạng là đã có thể sử dụng và hoạt động bình thường. Tất cả các bài viết được đăng tải trước kia sử dụng cấu trúc permalink cũ sẽ trả lại kết quả HTTP 404 trừ khi trỏ lại địa chỉ từng bài viết bằng cách thủ công cùng với Permalinks Migration. Vậy phải làm thế nào để đơn giản hóa quá trình này? Bất cứ toán tử nào sử dụng đường dẫn URL hiện tại sẽ lập tức trỏ tới HTTP 301 yêu cầu module mod_rewrite được kích hoạt trong hệ thống Apache server, nhưng hiện tại đã bị tắt bỏ ở chế độ mặc định. Và đây là 1 trong những lý do gây ra hiện tượng trên.
Sử dụng locate để tìm kiếm nếu mod_rewrite.so có trên server:
sudo locate mod_rewrite.so
Thông thường, kết quả nhận được sẽ được tìm thấy trong /usr/lib/apache2/modules.
Chuyển sang thư mục modes-enabled:
cd /etc/apache2/mods-enabled
Tiến hành cập nhật và mở file rewrite.load:
sudo touch rewrite.load
sudo gedit rewrite.load

Paste lệnh sau vào file rewrite.load:
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
Tiếp đó, mở file /etc/apache2/sites-available/default và tìm những tham số sau:
Options Indexes FollowSymLinks MultiViews
AllowOverride None

và thay đổi thành:
Options Indexes FollowSymLinks MultiViews
AllowOverride all

Cuối cùng, khởi động lại Apache:
sudo /etc/init.d/apache2 restart
Chúc các bạn thành công!
quantrimang (theo howtoforce)

6 comments:

Anonymous said...

If you own one of the newer, Unibody Mac - Book or Mac - Book Pro systems, it's a little tougher, but not impossible. TUAW was even claimed that a product will be launched in last year's Christmas shopping season.
Component Prices Are Falling: Unfortunately, computers aren't priced based on the current market.

Feel free to surf to my web-site; macbook pro

Anonymous said...

The recently unveiled Samsung Galaxy Tab looks set to rival the popular Apple i -
Pad. 3 inches screen, there is 285 pixel in one inch, it is also called ppi.
With this Samsung Galaxy Tab media dock You can convenient sync the tablet with a computer and charge it at the same time.


Here is my website: samsung galaxy tab 2

Anonymous said...

The apple tv is much cheaper now, at only $99, a far
cry from what it used to sell for back in 2007 when it was more
than $200. However, we can't choose our favorite program and movie when we watch TV. A smooth interface, lots of recommendations, and even the new Just for Kids section.

Anonymous said...

Although I've since switched from a Canon consumer camera to a Nikon prosumer camera (the D300), I still use the Nikon version of the same lenses. A tripod or sturdy table is a must when holding any superzoom camera steady. In order to remove the lens, depress the lens release button and rotate the lens clockwise.

my page - nikon d7100

Anonymous said...

Many homes have fireplaces for both warmth and decor.

Fadell has worked with Steve Jobs for several years and architected Apple's i - Pod and the first few versions of the i - Phone, some of the most successful consumer electronics products in our time. It's african american and
roughly how large a new football; the actual converter operates if the machine is for the cool placing, and also the thermostat is
set for a frigid temperatures.

Take a look at my blog post: nest thermostat

Anonymous said...

However, the spokesperson further clarified
that the Galaxy S4 in the UK will be available with a 1.
Because we're functioning off of absolutely nothing more than pure rumors and speculation, I might be looking at as well much into this and the i - Phone start has been and will carry on to be delayed for simple and extremely evident factors. It runs in very smooth and customized way to keep its users satisfied.

Also visit my web page :: samsung s4

Post a Comment