[英]Rewrite get parameter with .htaccess?
i want a htaccess url like 我想要像这样的htaccess网址
mysite.com/category/1
for 对于
mysite.com/category.php?cat=1
my htaccess 我的htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Have an simple idea ? 有一个简单的主意吗? Thank you :-)
谢谢 :-)
You are not capturing the right information (you should split the name from the number) and you are not adding the query variable: 您没有捕获正确的信息(应该从数字中拆分名称),也没有添加查询变量:
RewriteRule ^([^\.]+)$ $1.php [NC,L]
should be something like: 应该是这样的:
RewriteRule ^(\w+)/(\d+)$ $1.php?cat=$2 [NC,L]
^^^^^ capture the number
^^^^^ capture the name
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.