Tạo URL đẹp cho Drupal site với Pathauto Module

Tạo URL đẹp cho Drupal site với Pathauto Module

This tutorial was requested by a student who is learning the Drupal basics. They turned on "Clean URLs" in the Drupal admin area and were surprised to see that the URLs remained largely unchanged:

  • Old: /?q=node/3
  • New: /node/3

The student's comment was:

"that's still a silly address for my About Us page. I want the address to be /about-us/."

We also tried to help them by turning on the Path module in the Drupal core. That allowed them to create URLs like /about-us/ however they still needed to think about it and ask their users to create a path every time. They wanted something that would create great URLs automatically.

The solution is the "Pathauto" module and let's show you how to set it up:

Installing Pathauto to Your Drupal Site

In fact, we're going to install two modules because Pathauto also requires the "Token" module.

  • Step 1: Go to Administer >> Site configuration >> Clean URLs to check that they are enabled.
  • Step 2: Click here to download the latest version of "Pathauto" and click here for "Token".
  • Step 3: Extract the files into a two folders on your desktop. One  folder will be called "pathauto" and the other "token".
  • Step 4: Login to your site's files via FTP and navigate to /sites/all/. If there isn't a folder called /modules/ here, create one.
  • Step 5: Upload the "sections" folder to /sites/all/modules/
  • Step 6: Go to Administer >> Site building >> Modules. You'll need to check four boxes:

    Improving Drupal's Clean URLs with the Pathauto Module

  • Step 7: Go and create a new node. When you do, you should notice a new area labelled "URL path settings". If you leave "Automatic alias" checked, the address of the page will likely be your Page title in this format:
    /content/your-page-title/

    Enable Drupal Pathauto

Configuring Pathauto

The default Pathauto setting might not be to everyone's taste:

  • You may want to use underscores _ instead of dashes as this student did.
  • You may want to remove /content/ so that you really can have pages with the address /about-us/ rather than /content/about-us/

To change the settings, go to Administer >> Site building >> URL aliases >> Automated Alias Settings:

Drupal Pathauto Settings

Bạn thấy bài viết này như thế nào?: 
Average: 4.5 (2 votes)
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Bình luận (0)

 

Add Comment

Filtered HTML

  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Các thẻ HTML được chấp nhận: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Tự động ngắt dòng và đoạn văn.

Plain text

  • No HTML tags allowed.
  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Tự động ngắt dòng và đoạn văn.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Steve Jobs, Mark Zuckerberg lọt “top” nhà cải cách vĩ đại nhất

Steve Jobs, Mark Zuckerberg lọt “top” nhà cải cách vĩ đại nhất

Steve Jobs, cố CEO của Apple được vinh danh là người đổi mới vĩ đại thứ 2 của mọi thời đại, sau Thomas Edison trong bảng xếp hạng Lemelson-MIT Invention Index 2012

Phần 1: Hướng dẫn Data Migration từ HTML Pages vào Drupal 7

Phần 1: Hướng dẫn Data Migration từ HTML Pages vào Drupal 7

I recently was faced with a project where the client has a "database" of items that will be brought into the brand new Drupal 7 site that we are preparing for him.

Apple iOS 5 Complete Guide

51 ứng dụng miễn phí tốt nhất dành cho iPhone

Apple iOS 5 là một bản cập nhật lớn với một lượng lớn các tính năng mới. Vì vậy, hôm nay ở đây chúng tôi sẽ cung cấp cho bạn thông tin chi tiết về cách bạn có thể sử dụng và tùy chỉnh các tính năng mới của Apple iOS 5.

Công ty diệt chuột T&C

 

Diet con trung