建站教程

建站教程

Products

当前位置:首页 > 建站教程 >

建站技术:WordPress伪静态规则

GG网络技术分享 2025-03-18 16:07 0



伪静态是把动态的网页伪造为静态的页面。如 youranzixue.com/?p=38 中带有问号,这种称为动态链接,可以通过伪静态设置把网站修改为 youranzixue.com/38.html。没有问号的页面我们可以称为静态页面。

当用户访问 38.html 这个网页时,地址栏保持不变,程序实际是去请求了?p=38页面显示出来。这样的重写由服务器上的伪静态重写组件完成。目前大部分主机都支持伪静态设置。

不同的WEB服务器设置伪静态规则的方式不一样。

IIS

不同的IIS版本使用不同的方式设置伪静态规则,如httpd.ini.web.config等文件方式。不建议使用IIS安装WordPress程序。

httpd.ini方式

[ISAPI_Rewrite]# Defend your computer from some worm attacks#RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]# 3600 = 1 hourCacheClockRate 3600RepeatLimit 32 # Protect httpd.ini and httpd.parse.errors files# from accessing through HTTP# Rules to ensure that normal content gets throughRewriteRule /tag/(.*) /index\.php\?tag=$1RewriteRule /software-files/(.*) /software-files/$1 [L]RewriteRule /images/(.*) /images/$1 [L]RewriteRule /sitemap.xml /sitemap.xml [L]RewriteRule /favicon.ico /favicon.ico [L]# For file-based wordpress content (i.e. theme), admin, etc.RewriteRule /wp-(.*) /wp-$1 [L]# For normal wordpress content, via index.phpRewriteRule ^/$ /index.php [L]RewriteRule /(.*) /index.php/$1 [L]

web.config方式

标签:

提交需求或反馈

Demand feedback