我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

mod_rewrite添加另一个规则

RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ index.php?p=$1 [L]

I use this to forward all routing to index.php, If I would to rewrite the following:

http://localhost/folder/method/value

And that would be

http://localhost/folder/method/?f=value

How do I make it work?

See the mod rewrite tage wiki and example 6.

For your specific case you could just prepend a rule like

RewriteRule ^(\w+)/(\w+)/(\w+)$  $1/$2/?f=$3 [L]

See also Serverfault: Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask? to learn about rule ordering.

近期文章

  • 流在php中读取文件
  • 保存并关闭按钮javascript
  • fread fseek utf-8 file + flock?
  • PHP和Bing Translation API
  • 要删除的冗余标签[重复]
  • 显示会话过期消息
  • 如何将id附加到php中的路径
  • jQuery Datatable:编辑按钮
  • 如何从Facebook退出
  • 从twitter导入图片
  • 使用curl加载头部内容
  • CakePHP电子邮件编码问题
  • 在PHP中使用AWK的`-F,'{print $ 1}'
  • 在PHP中加载XML LOCAL INFILE
  • 将数据上传到服务器内存
  • Memcached不在php中工作
  • mkdir拒绝许可
  • Magento跳过一些电子邮件
  • 代码帮助,无限的PHP菜单
  • 未定义的变量PHP错误

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华