一、Apache的伪静态配置

1、网站根目录下需要有 .htaccess 文件,没有则自己创建一个,内容为

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

如果你的apache是fastcgi模式下,则需要修改

RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
替换成
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]

2、在apache的配置文件httpd.conf中查找 : LoadModule rewrite_module modules/mod_rewrite.so  将前面的#去掉,假如没有这段内容,则需要手动加上

3、在apache的配置文件httpd.conf中查找所有的 AllowOverride None,将 None 都替换成 All . 保存文件 并重启apache服务。

二、Nginx的伪静态配置

找到nginx的配置文件 nginx.conf, 在里面的 server{ } 里增加以下内容

location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}

重启nginx即可生效

  

三、IIS的伪静态配置

如果你的服务器环境支持ISAPI_Rewrite的话,可以配置httpd.ini文件,添加下面的内容:
RewriteRule (.*)$ /index\.php\?s=$1 [I]
在IIS的高版本下面可以配置web.Config,在中间添加rewrite节点:
<rewrite>
<rules>
<rule name="OrgPage" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(.*)$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" />
</rule>
</rules>
</rewrite>

  

最新文章

  1. Mysql 启动错误:the server quit without updating pid
  2. Linux中执行shell脚本的4种方法
  3. Lowest Common Ancestor
  4. 关于File.getPath,File.getAbsolutePath,File.getCanonicalPath的区别
  5. 一种好的持久层开发方法——建立BaseDao和BaseDaoImpl
  6. TortoiseSVN显示图标不正常
  7. 从Git到GitHub,详细教程
  8. 末学者笔记——SAMBA服务、FTP服务讲解
  9. 纯js自动批量引入js、css插件,支持自定义参数
  10. [转]php hash_pbkdf2 和 node.js crypto.pbkdf2
  11. PlugNT CMS v4.6.3 最新功能
  12. NPOI 设置样式为粗体
  13. 一次xxoo提权
  14. [java]struts2入门
  15. new和delete重载
  16. Linux读书笔记第五章
  17. FireDAC 下的 Sqlite [10] - 使用 R-Tree 搜索
  18. Python3 socketserver模块
  19. C#穿透session隔离———Windows服务启动UI交互程序
  20. [Backbone] Working with forms

热门文章

  1. Android埋点技术分析
  2. ExtJs 4.1.1 文件结构解析
  3. 【转】虚拟机安装Ubuntu的上网设置(有线网络和无线网络)
  4. LeetCode 题解之Add Two Numbers II
  5. 6.servlet和jsp的区别
  6. 如何让你的Ssh连接,更加安全?
  7. Oracle EBS PO采购订单更新
  8. sql server 查询ntext字段长度
  9. Jmeter入门--性能测试实战
  10. 理解 Linux 的平均负载和性能监控