伪静态页

phpok伪静态页规则和wordpress基本上是一样的!如果不会配置规则,把wordpress拿过来,基本上可以用的!

Apache伪静态页配置,在PHPOK根目录入创建 .htaccess 文件,将下面的代码复制进去即可!

  1. RewriteEngine on
  2. RewriteBase /
  3. RewriteRule ^index.php$ - [L]
  4. RewriteCond %{REQUEST_FILENAME} !-f
  5. RewriteCond %{REQUEST_FILENAME} !-d
  6. RewriteRule ^. index.php [L]

IIS7.0+的伪静态页配置,需要在 web.config 下增加下列规则(这里包含默认首页的增加)

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3. <system.webServer>
  4. <defaultDocument>
  5. <files>
  6. <clear />
  7. <add value="index.php" />
  8. </files>
  9. </defaultDocument>
  10. <rewrite>
  11. <rules>
  12. <rule name="PHPOK" stopProcessing="true">
  13. <match url="^(.*)$" />
  14. <conditions>
  15. <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
  16. <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
  17. </conditions>
  18. <action type="Rewrite" url="index.php/{R:0}" appendQueryString="true" />
  19. </rule>
  20. </rules>
  21. </rewrite>
  22. </system.webServer>
  23. </configuration>

Nginx伪静态页规则请写在 localhost /{……….} 里来,代码如下:

  1. if (!-f $request_filename){
  2. set $rule_0 1$rule_0;
  3. }
  4. if (!-d $request_filename){
  5. set $rule_0 2$rule_0;
  6. }
  7. if ($uri !~ "=/favicon.ico"){
  8. set $rule_0 3$rule_0;
  9. }
  10. if ($rule_0 = "321"){
  11. rewrite ^/ /index.php last;
  12. }