开启drupal的clear urls

所谓的clear urls就是把类似www.drupal.com/?q=admin转化成www.drupal.com/admin、这样好处有两个、一个是更容易被搜索引擎搜集到、另一个当然是容易记住啦、哈哈

如果迩是使用apache作为http服务器、那么可以直接在drupal上开启clear urls、

Administration->Configureation->Search and metadata->Clean URLs、然后直接开启就可以了

如果迩是nginx服务器、那么就需要在配置文件写些内容以模拟apache的转发功能、在server段里加入以下内容

server {
listen 80;
...

location / {
index index.html index.htm index.php;
try_files $uri @rewrite;
}

location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}

...

}

一、新建一个location @rewrite的段落、描述转发规则、第二、在location /段落里、添加使用转发规则的try_files这句、重启nginx后就可以在drupal里开启clear urls功能啦

posted @ 2012-02-15 10:19  klobodnf  阅读(342)  评论(0编辑  收藏  举报