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

用htaccess显示php文件就像一个目录

hi i want something like this when user write www.test.com/6
in the behind it will go to http://www.test.com/index.php?id=6 but this is not redirection it will be mod_rewrite

i do something like this but i get internal server error

Options +FollowSymLinks RewriteEngine on RewriteRule ([0-9]*)$ /index.php?id=$1 [L,NC]

I've written a very similar mod_rewrite line for one of my own projects. The regex could probably use some polishing, but it works, so here it is anyway:

RewriteRule ^([0-9]+)(/)?$ /path/to/file.php?id=$1 [QSA]

近期文章

  • 允许店铺经理使用革命滑块
  • 如何在php中增加执行超时?
  • 使用FOSOAuthServerBundle的登录表单
  • SQL组内连接无法获得所有结果
  • 如果库存水平= 0,magento hide立即购买按钮
  • bootstrap数据表自定义下拉过滤器
  • 使用HttpWebRequest的ASP.NET到Wordpress SSO
  • cURL解析divs来自其他页面的类数据
  • xml独立标记的简单xml问题
  • 从json结果中提取一位数据
  • PHP / MySQL中的地理搜索(距离)(性能)
  • 更新MySQL数据库中的加密密码
  • 使用PHP将文件上传到路径时出现问题
  • 在PHP中使用GET方法时的SESSION问题
  • 将带有curl的xml字符串发布到Web服务
  • 替代基于Java / Spring的Web服务
  • 拒绝使用.htaccess访问多个.php文件? [重复]
  • Git在命令上使用--work-tree和--git-dir
  • Symfony2 Prototype包含不需要的字段
  • 如果用户已登录,请添加javascript文件

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华