步骤

  • 开启重写模块:具体请百度,如果使用空间,一般空间商默认已经开启。
  • 后台配置:到后台配置参数中开启伪静态开关。
  • 创建.htaccess文件:在站点目录建立 .htaccess 文件(可到源码包 rewrite 目录下拷贝规则),规则内容如下:
<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On
  
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  
  RewriteRule ^(.*)$ index.php?p=$1 [QSA,PT,L]
</IfModule>