Loading... typecho默认地址...我绝不懂。反正觉得伪静态的看着顺眼一点哈哈哈 原来是长这样子的:https://cnotcat.cn/index.php/archives/1/ 开启伪静态之后:https://cnotcat.cn/17.html **教程** 在后台-`设置`-`永久链接`,`启用地址重写功能`,并将`自定义文章路径`改为:`/{cid}.html`  然后你就会收到这个提示,直接勾选`仍然启用`就好了  然后去服务器配置伪静态,我的是宝塔,所以:  **Nginx:** ```shell location / { index index.html index.php; if (-f $request_filename/index.html) { rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php) { rewrite (.*) $1/index.php; } if (!-f $request_filename) { rewrite (.*) /index.php; } } ``` 至于 Apache 环境和Windows IIS我还没试过,代码放下面,有需要的小伙伴可以试一下: **Linux Apache 环境 (.htaccess):** ```shell <IfModule mod_rewrite.c> RewriteEngine On # 下面是在根目录,文件夹要修改路径 RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] </IfModule> ``` **Windows IIS 伪静态 (httpd.ini):** ```shell [ISAPI_Rewrite] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 # 中文tag解决 RewriteRule /tag/(.*) /index\.php\?tag=$1 # sitemapxml RewriteRule /sitemap.xml /sitemap.xml [L] RewriteRule /favicon.ico /favicon.ico [L] # 内容页 RewriteRule /(.*).html /index.php/$1.html [L] # 评论 RewriteRule /(.*)/comment /index.php/$1/comment [L] # 分类页 RewriteRule /category/(.*) /index.php/category/$1 [L] # 分页 RewriteRule /page/(.*) /index.php/page/$1 [L] # 搜索页 RewriteRule /search/(.*) /index.php/search/$1 [L] # feed RewriteRule /feed/(.*) /index.php/feed/$1 [L] # 日期归档 RewriteRule /2(.*) /index.php/2$1 [L] # 上传图片等 RewriteRule /action(.*) /index.php/action$1 [L] nginx 配置 server { listen 80; server_name yourdomain.com; root /home/yourdomain/www/; index index.html index.htm index.php; if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; } location ~ .*\.php(\/.*)*$ { include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; } access_log logs/yourdomain.log combined; } ``` 最后修改:2022 年 01 月 15 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 0 如果觉得我的文章对你有用,请随意赞赏
1 条评论
??