我想在.htaccess文件中重写网址

时间:2018-06-29 07:43:52

标签: php rest url

我想重写import re regex = r"(?:.*(?:\r?\n)+){2}age(?:.*(?:\r?\n|$)+){3}" test_str = (" Pratap\n" "pandey\n" "age\n" "25\n" "student") matches = re.finditer(regex, test_str, re.MULTILINE) for match in matches: matchNum = matchNum + 1 print (match.group()) 文件中的URL。在.htaccess的localhost中,以localhost/pdo/connect?id=3的身份使用

localhost/pdo/connect/3

但是在connect.php中出现错误:

  

$ _ Get [“ id”]中未定义的索引ID

1 个答案:

答案 0 :(得分:0)

尝试这个

RewriteCond "%{REQUEST_URI} "!connect.php"

RewriteRule ^connect/([^/]+).*" "connect.php?id=$1" [L,QSA,PT]

上述规则的工作如下。

www.sitename.com/connect/id

相关问题