首页 > 新闻 > wordpress win主机用404实现静态化

wordpress win主机用404实现静态化

win主机的wordpress用户可能会相当头痛静态化的问题,如果服务器没有
安装类似rewrite的组件的话,静态化将会相当的麻烦。不过呢,下面这段
代码为我们提供了另外一种简单的方式来实现静态化。

 <?php
header("HTTP/1.1 200 OK");
$ori_qs = $_SERVER['QUERY_STRING'];
$pattern = '/[^;]+;[^:]+:\/\/[^\/]+(\/[^\?]*)(?:\?(.*))?/i';

preg_match($pattern, $ori_qs, $matches);
$_SERVER['PATH_INFO'] = $matches[1] . '?' . $matches[2];
$_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
$query_args = explode('&', $matches[2]);
unset($_GET);
foreach ($query_args as $arg)
{
    $the_arg = explode('=', $arg);
    $_GET[$the_arg[0]] = $the_arg[1];
}
include('index.php');
?>

设置固定链接(Permalink)伪静态步骤:
1. 将以上代码保存为 404.php,并上传至主机根目录。
2. 设置 404 自定义错误页为 404.php
3. 进入 WordPress 控制面板,设置(Options)- 固定链接Permalinks),选择固定链接格式。



类似“/2007/03/15/post-name/”式目录结构(例子:WordPress.com)
  Permalinks写法:/%year%/%monthnum%/%day%/%postname%/ 

类似“/2007/03/15/post-name.html”式目录结构(例子:boingboing.net)
  Permalinks写法:/%year%/%monthnum%/%day%/%postname%.html 

类似“/2007/03/post-name/”式目录结构(例子:WordPress.org blog)
  Permalinks写法:/%year%/%monthnum%/%postname%/ 

类似“/2007/03/post-name.html”式目录结构(例子:Blogger、TypePad)
  Permalinks写法:/%year%/%monthnum%/%postname%.html 

类似“/123.html”式目录结构(例子:livejournal、百度空间)
  Permalinks写法:/%post_id%.html 

我使用的“/category/post-name.html”式目录结构
  Permalinks写法:/%category%/%postname%.html

  1. 2009年7月27日12:55 | #1

    [u][b]Xrumer[/b][/u]

    [b]Xrumer Kings

    We are Xrumer experts, we from been using [url=http://www.xrumerkings.com/]Xrumer[/url] fitted a sustained leisure now and recollect how to harness the colossal power of Xrumer and build it into a Bills machine.

    We also provender the cheapest prices on the market. Diverse competitors see fit order 2x or consistent 3x and a destiny of the opportunity 5x what we pervade you. But we believe in providing prominent help at a small affordable rate. The large something of purchasing Xrumer blasts is because it is a cheaper surrogate to buying Xrumer. So we focusing to stifle that bit in cognizant and outfit you with the cheapest censure possible.

    Not solitary do we cause the unexcelled prices but our turnaround in the good old days b simultaneously payment your Xrumer posting is wonderful fast. We drive take your posting done in the forefront you distinguish it.

    We also cater you with a sated log of well-heeled posts on different forums. So that you can see for yourself the power of Xrumer and how we get harnessed it to benefit your site.[/b]

    [b]Search Engine Optimization

    Using Xrumer you can expect to distinguish thousands upon thousands of backlinks for your site. Scads of the forums that your Install you settle upon be posted on have high PageRank. Having your tie-in on these sites can truly expropriate strengthen up some cover grade back links and as a matter of fact boost your Alexa Rating and Google PageRank rating via the roof.

    This is making your site more and more popular. And with this better in celebrity as grammatically as PageRank you can expect to lead your area definitely downright high in those Search Locomotive Results.
    Above

    The amount of traffic that can be obtained before harnessing the power of [url=http://www.xrumerkings.com/]Xrumer[/url] is enormous. You are publishing your locality to tens of thousands of forums. With our higher packages you may regular be publishing your locality to HUNDREDS of THOUSANDS of forums. Create 1 mail on a in demand forum last will and testament by cotton on to a leave 1000 or so views, with communicate 100 of those people visiting your site. At once assume tens of thousands of posts on in demand forums all getting 1000 views each. Your shipping will associate because of the roof.

    These are all targeted visitors that are interested or singular nearly your site. Assume how many sales or leads you can execute with this titanic number of targeted visitors. You are in fact stumbling upon a goldmine friendly to be picked and profited from.

    Keep in mind, Shipping is Money.
    [/b]

    BECOME ENTHUSIASTIC ABOUT YOUR CHEAP DEFAME TODAY:

    http://www.xrumerkings.com/

    buy xrumer
    xrumer blast
    xrumer blasts
    xrumer crack

  2. 2009年7月27日15:17 | #2

    [b]Who is Ciara Dating[/b]

    According to Bend Wow’s 106 [url=http://compingdium.com/blog/]Who is Ciara Dating [/url]& Leave interview, he and Ciara are relation and I of that she may be subjected to been the united to reason things because he seemed a bit miserable in it. I don’t comprehend who she is dating now. That photo of her on Nelly’s bedside on that In excess of and Over Again video did origin me to regard as of the likelihood of a relationship between Nelly & Ciara but it was after that that she went purchasers with her relationship with Bow Wow. Yesterday Who is Ciara Dating on 106 & Store, Lil Effervescence (time past of B2K) hinted that he would be interested in dating Ciara. Rocsi was unavoidable to accompany him out on that. Ciara is to all intents weighing Who is Ciara Dating her options and playing it cool right now. She Who is Ciara Dating may not be dating anyone.

  3. 2009年7月28日01:13 | #3

    [b]Who is Raven Symone dating[/b]

    Why is everybody else in the universe(not you, of no doubt) upsetting to “match” up Raven-Symone(in their crazy fantasies) w/ some of the wildest celebrities that in any case[url=http://whoisravensymonedating.compingdium.com/] Who is Raven Symone dating[/url] existed?

    Effectively, she has MORE SAFELY A IMPROVED tastes(and much HIGHER standards) in men, and past time again “corresponding” her up w/ such hard-to-describe guys like those two, that truly shows impudence for her life, her family, and her fans!

    OK, whoever “THUMBS-DOWN”-ed me has been reading too much Vibe or other rap-music-based magazines to identify the ACTUALITY!

    She’s choose be dating Tahj Mowry(the younger bro of Tia and Tamera) or Evan Ross than some Tupac Shakur “clone”!…now THAT’S the genuineness!

    Every now delight think of some TRUE guys she should date!…NO rappers!

    And, BTW, she’s stil a virgin!…and wants to Who is Raven Symone dating emulate the Jonas Brothers over the extent of their “sterile” lives and “no-dating-until-marriage” rules!

  4. 2009年7月28日03:12 | #4

    Chelsea Handler is year accomplished stand up comic making appearances all across the country. She edge Be seen regularly one the Oxygen network show Girls Behaving Badly, one the E! Chanel ace has regular commentator, one the Tonight Show ace has Tonight Show Correspond, ace well ace in many TV guest appearances. Chelsea’ S new book ” My Horizontal Life – has Collection One-Night Stands” off; is [url=http://forum.buffalostate.edu/index.php?showuser=11385]Who is chelsea handler dating[/url] already available one Amazon and the foreign rights cuts sold in over 16 countries.

  5. 2009年7月28日12:28 | #5

    [b]Who is Chelsea Handler dating[/b]

    In July 2007, Who is Chelsea Handler dating began starring on her own half-hour late-night comedy series on E! titled Chelsea Lately. This series places Handler against a slew of male-dominated talk shows, and adding a goodly amount of ridicule and ridicule to the format. On the indicate’s 100th chapter, Chelsea revealed to viewers that E! had picked up Chelsea Lately on the side of another 150 episodes.[9] The may be seen has proved a clip and averaged more than a half-million viewers since its premiere (much more than the norm exchange for a late shades of night cable program) and has clips on Youtube with more than a million views. All this ascendancy is consideration the Who is Chelsea Handler dating event that Handler’s guests frequently are not A-list celebrities. In a 2008 interview Handler said, “The worse the Who is Chelsea Handler dating guests are, the more plaintive they are, the funnier the show is.”[10] The Different York Times reported that Chelsea Lately has been renewed by E! to go on the lam until December 2009;[11] Handler received another pact proportions in Stride 2009 to nourish Chelsea Lately on the current on[url=http://whoischelseahandlerdating.compingdium.com/] Who is Chelsea Handler dating[/url] account of 2012.[12]

  1. 2009年7月12日00:04 | #1
您必须在 登录 后才能发布评论.