Configure web server for URL

2016-08-29 09:14:37    tengfei    9802

Zsite support two kinds of access, one is traditional "get", such as /?m=article&id=123 (123 is the name of the article you want to view), and the other one is to use URL, such as /article-view-123.html.


Zsite has built-in URL path which is search engine friendly. The URL address mentioned above will be article/123.html. if the article 12 belongs to certain category which has an alias, say news, the address will be news/123.html.


First, you have to configure web server for URL access. If you use site hosting, URL access is usually switched on. If not, please follow the instructions below to configure your web server.



Apache:

1. Configure Apache and load mod_rewrite.

2. Configure .htaccess in the directory of chanzhieps/www. For example,

<Directory /home/chanzhieps/www>
        Options FollowSymLinks Indexes
        AllowOverride All
    </Directory>


nginx:

location /
{
    try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$
{
    fastcgi_pass  unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $request_uri;
    include modules-enabled/fastcgi.conf;
}


If you have already installed Zsite and would like to use URL access, please make sure the configuration above is done first, and then reinstall Zsite, or modify requestType to PATH_INFO in chanzhi/system/config/my.php (5.2+ version has to choose Path_Info by going to "Settings"->"Site"->"Basic settings"->"Request Type”).

ZSite8.0