5.3 伪静态

ShopNC

5.3          伪静态

系统支持动态网址和伪静态两种URL形式,CONFIG(data/config/config.ini.php)中,url_model true表示开启伪静态,url_mode false 表示使用默认动态网址形式。系统伪静态是基于PATHINFO模式实现的,所以若开启伪静态,除更改CONFIG外,还需要配置APACHE/NGINX支持PATHINFO模式。

# apache 配置

# 编辑httpd.conf,加载 mod_rewrite.so

# 编辑httpd.conf,让Apache支持.htaccess

AllowOverride None改为AllowOverride All

# 在商城目录下新建.htccess文件,

# 若以 php-cgi 运行,加入以下内容

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

</IfModule>

 

# 若以php5apache2_2.dll 方式运行,加入以下内容

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

</IfModule>

 

# nginx配置

location / {

    if (!-e $request_filename)

    {

        rewrite ^/(.*)$ /index.php;

    }

}

 

location ~ \.php$ {

    fastcgi_split_path_info ^(.+\.php)(/.+)$;

    fastcgi_pass unix:/var/run/php5-fpm.sock;

    fastcgi_index index.php;

    include fastcgi_params;

    fastcgi_param PATH_INFO $request_uri;

}

 

 


Copyright ©2009 - 2014 shopnc.net.All rights reserved.
Powered By ShopNC