首页» 教程» Wordpress教程» 新手入门(十)WordPress伪静态

新手入门(十)WordPress伪静态

Hello,嗨,大家好,我是哈喽猿。

这里是哈喽猿网

今天推送的是wordpress教程的文章,感谢您宝贵的时间阅读

WordPress新手入门课程目录:

1.wordpress图片一号使用教程

2.wordpress博客二号主题使用教程   

3.WordPress添加自适应表格   

4.WordPress超级缓存插件Super Cache   

5.WordPress去除更新提示   

6.WordPress创建和管理文章分类   

7.WordPress基本设置   

8.WordPress创建导航菜单   

9.WordPress忘记密码   

10.WordPress伪静态

 

WordPress 伪静态

前言:伪静态最重要的是,为了方便搜索引擎蜘蛛(Spider)掌握网页上的相关内容,提高用户对网页的信任,使我们的网站能够在搜索引擎中有一个良好的排名,下面哈喽猿来教大家WordPress 如何使用伪静态

Nginx伪静态规则

nginx环境通常由VPS或Linux主机的服务器用户使用。这些用户通常自己配置nginx,或者有一个特殊的人来帮助您配置和打开它nginx.conf格式或站点的配置环境,例如wpdaxue.com.conf网站(与人工配置不同),在服务器{}大括号中添加以下代码,保存,重启 Nginx 即可。

location <span style="color: #339933;">/</span> <span style="color: #009900;">&#123;</span>
	try_files <span style="color: #000088;">$uri</span> <span style="color: #000088;">$uri</span><span style="color: #339933;">/</span> <span style="color: #339933;">/</span>index<span style="color: #339933;">.</span>php?<span style="color: #000088;">$args</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Add trailing slash to */wp-admin requests.
</span>rewrite <span style="color: #339933;">/</span>wp<span style="color: #339933;">-</span>admi

Apache伪静态规则

Apache是Linux主机下的一个常见环境,现在在普通Linux虚拟主机中使用。创建一个新的htaccess.txt文件,添加以下代码并将其上传到WordPress站点的根目录,将其重命名为.htaccess

<span style="color: #339933;">&lt;</span>IfModule mod_rewrite<span style="color: #339933;">.</span>c<span style="color: #339933;">&gt;</span>
RewriteEngine On
RewriteBase <span style="color: #339933;">/</span>
RewriteRule ^index\<span style="color: #339933;">.</span>php$ <span style="color: #339933;">-</span> <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span>
RewriteCond <span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span>REQUEST_FILENAME<span style="color: #009900;">&#125;</span> <span style="color: #339933;">!-</span>f
RewriteCond <span style="color: #339933;">%</span><span style="color: #009900;">&#123;</span>REQUEST_FILENAME<span style="color: #009900;">&#125;</span> <span style="color: #339933;">!-</span>d
RewriteRule <span style="color: #339933;">.</span> <span style="color: #339933;">/</span>index<span style="color: #339933;">.</span>php <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span>
<span style="color: #339933;">&lt;/</span>IfModule<span style="color: #339933;">&gt;</span>

IIS伪静态规则

IIS环境是windows主机的通用服务器环境。创建一个新的TXT文件,将以下代码添加到该文件中,并将其另存为httpd.ini公司文件,上传到WordPress站点的根目录。

<span style="color: #009900;">&#91;</span>ISAPI_Rewrite<span style="color: #009900;">&#93;</span>
<span style="color: #666666; font-style: italic;"># Defend your computer from some worm attacks
</span><span style="color: #666666; font-style: italic;">#RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]
</span><span style="color: #666666; font-style: italic;"># 3600 = 1 hour
</span>
CacheClockRate <span style="color: #cc66cc;">3600</span>
RepeatLimit <span style="color: #cc66cc;">32</span>

<span style="color: #666666; font-style: italic;"># Protect httpd.ini and httpd.parse.errors files
</span><span style="color: #666666; font-style: italic;"># from accessing through HTTP
</span><span style="color: #666666; font-style: italic;"># Rules to ensure that normal content gets through
</span>
RewriteRule <span style="color: #339933;">/</span>tag<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">.*</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span>index\<span style="color: #339933;">.</span>php\?tag<span style="color: #339933;">=</span>$<span style="color:#800080;">1</span>
RewriteRule <span style="color: #339933;">/</span>software<span style="color: #339933;">-</span>files<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">.*</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span>software<span style="color: #339933;">-</span>files<span style="color: #339933;">/</span>$<span style="color:#800080;">1</span> <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span>
RewriteRule <span style="color: #339933;">/</span>images<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">.*</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span>images<span style="color: #339933;">/</span>$<span style="color:#800080;">1</span> <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span>
RewriteRule <span style="color: #339933;">/</span>sitemap<span style="color: #339933;">.</span>xml <span style="color: #339933;">/</span>sitemap<span style="color: #339933;">.</span>xml <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span>
RewriteRule <span style="color: #339933;">/</span>favicon<span style="color: #339933;">.</span>ico <span style="color: #339933;">/</span>favicon<span style="color: #339933;">.</span>ico <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span>
<span style="color: #666666; font-style: italic;"># For file-based wordpress content (i.e. theme), admin, etc.
</span>RewriteRule <span style="color: #339933;">/</span>wp<span style="color: #339933;">-</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">.*</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span>wp<span style="color: #339933;">-</span>$<span style="color:#800080;">1</span> <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span>
<span style="color: #666666; font-style: italic;"># For normal wordpress content, via index.php
</span>RewriteRule ^<span style="color: #339933;">/</span>$ <span style="color: #339933;">/</span>index<span style="color: #339933;">.</span>php <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span>
RewriteRule <span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">.*</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span>index<span style="color: #339933;">.</span>php<span style="color: #339933;">/</span>$<span style="color:#800080;">1</span> <span style="color: #009900;">&#91;</span>L<span style="color: #009900;">&#93;</span>

 

 

发表评论

0 评论

提供最优质的资源集合

站长留言