博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
.htaccess 的写法
阅读量:5825 次
发布时间:2019-06-18

本文共 2723 字,大约阅读时间需要 9 分钟。

RewriteCond

 

RewriteRule

 

 

记录下现在我会的:

RewriteEngine On #RewriteRule ^(.*)/(.*)/$ index.php?m=index&c=$1&a=$2 [QSA] #RewriteRule ^(.*)/$ index.php?m=index&c=$1&a=index [QSA] # yhy:测试test RewriteRule ^test$ index.php?c=test [QSA] RewriteRule ^test/(.*)/$ index.php?c=test&a=$1 [QSA] RewriteRule ^test/(.*)/(.*)\.html$ index.php?c=test&a=$1&id=$2 [QSA] # yhy:finance RewriteRule ^Finance/$ index.php?c=finance [QSA] RewriteRule ^Finance/type-(\d+)\.html$ index.php?c=finance&a=type&leixing=$1 [QSA] RewriteRule ^Finance/(.*)\.html$ index.php?c=finance&a=detail&id=$1 [QSA] # RewriteRule ^Finance/type-(\d+)/&page=(\d*)$ index.php?c=finance&a=index&leixing=$1&page=$2 [QSA] url:
 
 
nginx.htaccess
每次改写好后要重新启动服务器
if (!-e $request_filename) {
rewrite ^/login/$ /index.php?c=login last; rewrite ^/loginout/$ /index.php?c=loginout last; rewrite ^/regist/$ /index.php?c=regist last; rewrite ^/regist/(.*)/$ /index.php?c=regist&a=$1 last; rewrite ^/help/$ /index.php?c=help last; rewrite ^/finance/$ /index.php?c=finance last; rewrite ^/finance/login/(.*)\.html$ /index.php?c=center&a=login&id=$1 last; rewrite ^/finance/(.*)\.html$ /index.php?c=finance&a=info&id=$1 last; rewrite ^/safe/$ /index.php?c=safe last; rewrite ^/risk/$ /index.php?c=risk last; rewrite ^/lcc/$ /index.php?c=lcc last; rewrite ^/question/$ /index.php?c=question last; rewrite ^/guide/$ /index.php?c=guide last; rewrite ^/findpwd/$ /index.php?c=findpwd last; rewrite ^/findpwd/(.*)/$ /index.php?c=findpwd&a=$1 last; rewrite ^/center/$ /index.php?c=center last; #关于我们 rewrite ^/about/$ /index.php?c=about last; rewrite ^/about/(.*)/$ /index.php?c=about&a=$1 last; rewrite ^/about/(.*)/(.*)\.html$ /index.php?c=about&a=$1&id=$2 last; #处理一键绑定 rewrite ^/bangding/$ /index.php?c=binding last; rewrite ^/checkcustkey/$ /index.php?c=binding&a=checkcustkey last; #常见问题 rewrite ^/faq/$ /index.php?c=faq last; rewrite ^/faq/(.*)/$ /index.php?c=faq&a=$1 last; rewrite ^/faq/(.*)\.html$ /index.php?c=faq&id=$1 last; #P2P活动 rewrite ^/p2pactive/$ /index.php?c=p2pactive last; rewrite ^/p2pactive/page_(\d+)\.html$ /index.php?c=p2pactive&page=$1 last; rewrite ^/p2pactive/(.*)\.html$ /index.php?c=p2pactive&a=info&id=$1 last; #搜索c rewrite ^/type-(\d+)-(\d+)-(\d+)/$ /index.php?c=finance&a=index&tuijian=$1&shouyi=$2&qixian=$3 last; #短信 rewrite ^/msg/$ /index.php?c=msg last; #保单 rewrite ^/insurance/$ /index.php?c=insurance last; }

转载于:https://www.cnblogs.com/hfdp/p/5047649.html

你可能感兴趣的文章
灰度图像和彩色图像
查看>>
FreeMarker-Built-ins for strings
查看>>
argparse - 命令行选项与参数解析(转)
查看>>
修改上一篇文章的node.js代码,支持默认页及支持中文
查看>>
spring-boot支持websocket
查看>>
菜鸟笔记(一) - Java常见的乱码问题
查看>>
我理想中的前端工作流
查看>>
记一次Git异常操作:将多个repository合并到同一repository的同一分支
查看>>
Chrome 广告屏蔽功能不影响浏览器性能
查看>>
vSphere 6将于2月2日全球同步发表
查看>>
Android状态栏实现沉浸式模式
查看>>
让你的APP实现即时聊天功能
查看>>
使用Openfiler搭建ISCSI网络存储
查看>>
学生名单
查看>>
(转) 多模态机器翻译
查看>>
【官方文档】Nginx负载均衡学习笔记(三) TCP和UDP负载平衡官方参考文档
查看>>
矩阵常用归一化
查看>>
Oracle常用函数总结
查看>>
【聚能聊有奖话题】Boring隧道掘进机完成首段挖掘,离未来交通还有多远?
查看>>
考研太苦逼没坚持下来!看苑老师视频有点上头
查看>>