逗号CMS
先确定您的服务器环境,然后根据环境选择下列伪静态规则配置:
在网站配置文件的 server 块中添加:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}宝塔面板 → 网站设置 → 伪静态,粘贴:
location / {
try_files $uri $uri/ /index.php?$query_string;
}在网站根目录 .htaccess 文件中写入:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
</IfModule>在网站根目录创建 web.config 文件:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="douhao">
<match url="^(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>后台 → 网站设置 → 伪静态设置 Tab。
| 页面类型 | 格式 | 示例 |
|---|---|---|
| 文章详情页 | 【前缀】【ID/哈希/MD5】.html | article-123.html |
| 文章分类页 | 【前缀】【ID/哈希/MD5】.html | category-1.html |
| 产品详情页 | 【前缀】【ID/哈希/MD5】.html | product-123.html |
| 产品分类页 | 【前缀】【ID/哈希/MD5】.html | product-category-1.html |
每个页面类型的前缀都可以自定义,例如将 article- 改为 post- 或者 post/。
输入问题,快速查找相关问答
写下您的问题,我们会尽快为您解答