Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
喜欢用rewritecond的twitter url吗?_Url_.htaccess_Mod Rewrite_Url Rewriting - Fatal编程技术网

喜欢用rewritecond的twitter url吗?

喜欢用rewritecond的twitter url吗?,url,.htaccess,mod-rewrite,url-rewriting,Url,.htaccess,Mod Rewrite,Url Rewriting,我想要一个简单的帮助。我有这样一个URL:/profile.php?id=&name= 我的.htaccess文件如下: RewriteRule ^profile/(.*)/(.*) profile.php?id=$1&name=$2 所以我有一个这样的结束URL:/profile/ 我可以做。但是我怎样才能得到像/ 我可以使用RewriteCond来生成条件? 我仍然不太了解.htaccess。如果名称和ID的值中有不同的模式,您可以在规则中使用这些模式,例如: # numerica

我想要一个简单的帮助。我有这样一个URL:/profile.php?id=&name=

我的.htaccess文件如下:

RewriteRule ^profile/(.*)/(.*) profile.php?id=$1&name=$2
所以我有一个这样的结束URL:/profile/

我可以做。但是我怎样才能得到像/

我可以使用RewriteCond来生成条件?
我仍然不太了解.htaccess。

如果名称和ID的值中有不同的模式,您可以在规则中使用这些模式,例如:

# numerical IDs
RewriteRule ^[1-9]\d*$ profile.php?id=$0

# names
RewriteRule ^[a-z]+$ profile.php?name=$0