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

 
Dù muốn hay không, người dùng Facebook vẫn phải sử dụng giao diện Timeline!

Dù muốn hay không, người dùng Facebook vẫn phải sử dụng giao diện Timeline!

Facebook vừa thông báo trên trang Blog của mình rằng giao diện Timeline sẽ áp dụng cho tất cả người dùng trong vòng vài tuần nữa.

Facebook “góp mặt” trong 1/3 số vụ li hôn tại Anh

Facebook “góp mặt” trong 1/3 số vụ li hôn tại Anh

Facebook đang phát triển nhanh chóng khắp thế giới, tuy nhiên, mạng xã hội lớn nhất hành tinh này lại “gặt” thêm tiếng xấu khi là một trong số những nguyên nhân chính...

Modules Migrate và Migrate D2D cho lập trình viên Drupal năm 2015

Modules Migrate và Migrate D2D cho lập trình viên Drupal năm 2015

This unorthodox decision was made to support substantial improvements in Drupal’s major version upgrade process

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

 

Diet con trung