Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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
.htaccess重写规则:将破折号(-)添加到我的域_.htaccess - Fatal编程技术网

.htaccess重写规则:将破折号(-)添加到我的域

.htaccess重写规则:将破折号(-)添加到我的域,.htaccess,.htaccess,我想从以下位置修改我的URL: domain/content.php?page=x 致: 我将此代码放入我的文件.htaccess: RewriteRule ^([a-zA-Z0-9\-]+)$ content.php?page=$1 [L] 您能帮助我吗?如果您不想要URL的y部分,您不需要创建与之匹配的分组: RewriteRule ^([^-]+)- /content.php?page=$1 [L] 所以您希望它是domain/content.php?page=x-y?你能更好地描述

我想从以下位置修改我的URL:

domain/content.php?page=x
致:

我将此代码放入我的文件
.htaccess

RewriteRule ^([a-zA-Z0-9\-]+)$ content.php?page=$1 [L]

您能帮助我吗?

如果您不想要URL的
y
部分,您不需要创建与之匹配的分组:

RewriteRule ^([^-]+)- /content.php?page=$1 [L]

所以您希望它是
domain/content.php?page=x-y
?你能更好地描述你的问题并提供更准确的例子来说明你想要达到的目标吗?
RewriteRule ^([^-]+)- /content.php?page=$1 [L]