加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 带.htaccess的漂亮网址

发布时间:2020-12-13 13:34:43 所属栏目:PHP教程 来源:网络整理
导读:我有一个URL http://localhost/index.php?user = 1.当我添加这个.htaccess文件时 Options +FollowSymLinksRewriteEngine OnRewriteRule ^user/(.*)$./index.php?user=$1 我现在可以使用http:// localhost / user / 1链接.但是http://localhost/index.php
我有一个URL http://localhost/index.php?user = 1.当我添加这个.htaccess文件时
Options +FollowSymLinks
RewriteEngine On

RewriteRule ^user/(.*)$./index.php?user=$1

我现在可以使用http:// localhost / user / 1链接.但是http://localhost/index.php?user = 1& action = update怎么样才能进入http:// localhost / user / 1 / update?

另外如何制作这个网址http:// localhost / user / add?
谢谢.对不起,我对.htaccess比较新.

你可以写这样的东西:
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)$/index.php?user=$1&action=$2 [L]

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读