wordpress网站伪静态设置

众所周知wordpress默认的链接是动态链接,虽然现在搜索引擎对动态的链接也有着非常好的收录,但是基于链接的美观,以及伪静态对搜索引擎更加有好的原因,我们还是非常希望能够将我们的wordpress设置成为伪静态方式,那么今天我们就来说一说,如何设置wordpress的伪静态。

 

wordpress伪静态设置

 

这样Linux主机的伪静态就OK了! 如果你的主机没有一键设置伪静态的按钮,那么就需要手工去填写了:

根据官方和网上的帖子所显示,将以下代码

# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>

# END WordPress

保存为.htaccess格式保存到根目录下就可以了。然后进入后台更改固定链接就可以了。

如果你的网站访问量非常大,那么伪静态可能不能满足你的要求了,因为动态的链接(伪静态也是伪的,不是真的)会造成服务器压力过大,所以我们需要来把我们的网站变成“真静态”!

首先安装WP Super Cache插件,这款插件能够生成html文件,让用户访问到的是真正的html!  这款插件现在已经升级了,非常好用,如果你是使用的Linux主机,那么你就可以安装它,然后在选项中选择推荐的选项,保存好,这样就设置好啦!

windows主机用户

对于win主机用户来说,这个伪静态就是非常麻烦了,因为win主机对PHP的支持还是没有Linux的好,不过只要你的主机允许一些功能,还是能够设置好伪静态的。

将以下代码

# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>

# END WordPress

保存为.htaccess格式保存到根目录下就可以了。然后进入后台更改固定链接,很多在使用Windows主机下新手这样做之后文章的链接带有index.php这个参数,网上很多教程采用404页面跳转的方式,但是所有的非必要跳转都是不友好的。那么,wordpress伪静态怎么去掉index.php呢?首先我们要知道原因,其实原因就是你的网站所在环境没有开启伪静态功能。而带有index.php参数的网址是伪伪静态。首先做伪静态你需要让你的网站所在的环境开启伪静态功能,常见的两种:

apache。apache开启伪静态很简单!

在conf目录下httpd.conf中找到

LoadModule rewrite_module modules/mod_rewrite.so

这句,去掉前边的注释符号“#”,或添加这句。(记得重启!)

这个很简单,我们不用多说。

网上还有很多的方法,但是这里不一一列举了,使用wordpress还是选择Linux主机的方便。

最后别忘了WP Super cache插件只适合在Linux类的主机上使用,Windows主机不能使用WP Super cache插件哦~  也就是说,“真静态”win主机是无福消受的!~

如果你正在选择主机的话,你可以了解一下美国主机推荐

大连网站建设

A nice entry

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim.

阅读更多

Entry with Audio

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer.

  • Donec posuere vulputate arcu.
  • Phasellus accumsan cursus velit.
  • Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;
  • Sed aliquam, nisi quis porttitor congue

阅读更多

Showcase-05

Entry without preview image

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

  1. Nulla consequat massa quis enim.
  2. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
  3. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.

Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.

阅读更多

Entry with Post Format “Video”

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.

Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.

 

阅读更多

A small gallery

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

  • Nulla consequat massa quis enim.
  • Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
  • In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.
  • Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi.

Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim.

阅读更多

A nice post

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.

Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim.

阅读更多

Post Formats is a theme feature introduced with Version 3.1. Post Formats can be used by a theme to customize its presentation of a post.

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus – more on WordPress.org: Post Formats