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创建干净的URL结构_.htaccess - Fatal编程技术网

使用.htaccess创建干净的URL结构

使用.htaccess创建干净的URL结构,.htaccess,.htaccess,如何重定向 website.com/path/?p=4927304 到 website.com/path/4927304 数字是动态的 非常感谢此规则将像/path/?p=4927304这样的URL重定向到/path/4927304: RewriteCond %{QUERY_STRING} ^p=([0-9]+)$ RewriteRule ^path/$ /path/%1 [R] @_drow之前已经得到了回答(出现在相关链接中)@Robus:如果你投了反对票,请留下评论。特别是如果它是dup

如何重定向

website.com/path/?p=4927304

website.com/path/4927304

数字是动态的


非常感谢

此规则将像
/path/?p=4927304
这样的URL重定向到
/path/4927304

RewriteCond %{QUERY_STRING} ^p=([0-9]+)$
RewriteRule ^path/$ /path/%1 [R]

@_drow之前已经得到了回答(出现在相关链接中)@Robus:如果你投了反对票,请留下评论。特别是如果它是dup,其他人可以投票关闭它。我认为它应该是RewriteCond%{QUERY_STRING}^p=([0-9]+)$