月度归档: 2023 年 12 月

  • ThinkPHP5.1的Apache和Nginx配置

    每次部署 ThinkPHP5.1 的程序,伪静态总要出点问题,和 Laravel、WordPress 等程序的不太一样,这里记录一下,备用。

    For APACHE:

    <IfModule mod_rewrite.c>
      Options +FollowSymlinks -Multiviews
      RewriteEngine On
    
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
    </IfModule>

    For Nginx:

    location / {
        if (!-e $request_filename) {
            rewrite  ^(.*)$  /index.php?s=/$1  last;
        }
    }