ci框架里rewrite示例
2015-12-20 17:16
453 查看
ci里新建应用app,入口文件app.php。
app.52fhy.com.conf
nginx重启命令为:
url访问示例:
实际url为
实现了隐藏入口文件的功能。
Nginx
这里附上vhost配置app.52fhy.com.conf
server { listen 80; server_name app.52fhy.com; index app.php; root /www/test/ci/; location ~ .*\.(php|php5)?$ { #fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_index app.php; include fastcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 1h; } location / { if (!-e $request_filename) { rewrite ^/(.*)$ /app.php?/$1 last; break; } } access_log /www/log/nginx/access/app.52fhy.com.log; }
nginx重启命令为:
/usr/local/nginx/sbin/nginx -s reload
url访问示例:
http://app.52fhy.com/Test/hello
实际url为
http://app.52fhy.com/app.php/Test/hello
实现了隐藏入口文件的功能。
Apache
<IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /app.php/$1 [QSA,PT,L] </IfModule>
相关文章推荐
- 为你的WordPress博客添加CSS3炫酷读者墙
- litcode 合并两个排序链表 递归求解
- html5的结构标记与内联元素
- 《需求分析与系统设计》读书笔记2
- 信息安全系统设计基础第十五周总结
- TopCoder SRM676 Div. 2 Problem 550 - BoardEscapeDiv2
- shell split 字符串 三种方式和效率
- html5的程序接口与元素变化
- HTML5 地理位置定位API(4)
- 让你的网站high起来
- TQ2440 虚拟机 开发板 PC 三者互相ping通
- java 效率编程(创建对象)
- 提取pdf文件文本:pdfparser与xpdf具体操作
- gem5: 缓存中如何设置writeback dirty cachelines并invalidate该缓存块
- [实战]MVC5+EF6+MySql企业网盘实战(20)——Bootstrap Paginator
- 【Beta】Daily Scrum Meeting总结
- 【iOS开发】多屏尺的自动适配 AutoLayout (纯代码方式)
- nfs部署
- 带图片(drawableXxx)的TextView
- 每天学点Python之数值类型