Drupal 7 开发内部培训资料, 分头诗人

如何配置drupal 的简洁链接

赞成!
0
否决!

我安装好drupal 后,地址全部是 drupalla.com/?q=node/1 等格式,如何让它变成drupalla.com/node/1 这样的简洁链接啊?

1 个回答

赞成!
1
否决!

XAMPP集成安装包为例: 1、 F:\xampp\apache\conf,在该目录下找到httpd.conf文件,打开,找到#LoadModule rewrite_module modules/mod_rewrite.so。 将前面的注释符“#”去掉。 2、把F:\xampp\apache\conf\apache conf里面的AllowOverride None改为了AllowOverride All

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<Directory "F:/xampp/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important. Please see
    # <a href="http://httpd.apache.org/docs/2.2/mod/core.html#options" 
title="http://httpd.apache.org/docs/2.2/mod/core.html#options">
http://httpd.apache.org/docs/2.2/mod/core.html#options</a>
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI
  
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All
 
    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all
 
</Directory>

nginx 下面可以在vhost.conf 下增加代码:

1
2
3
4
5
6
7
8
9
10
server {
[...]
 
if (!-e $request_filename) {
 
rewrite ^/(.*)$ /index.php?q=$1 last;
 
}
 
[...]