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?
你可以写这样的东西:
RewriteEngine On RewriteRule ^([^/]*)/([^/]*)$/index.php?user=$1&action=$2 [L] (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |