Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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中的Apache重写规则问题_Apache_.htaccess_Url_Mod Rewrite - Fatal编程技术网

.htaccess中的Apache重写规则问题

.htaccess中的Apache重写规则问题,apache,.htaccess,url,mod-rewrite,Apache,.htaccess,Url,Mod Rewrite,我必须永久重定向所有URL: http://www.example.com/?par=1248 (with and without the www) 到 使用.htaccess文件 我在上面使用的占位符“par”和“1248”可以是任何内容(字符、数字等)这应该适合您并重定向您想要的URL: RewriteEngine On RewriteCond %{THE_REQUEST} ^(GET|POST)\ /\?(.*)\ HTTP RewriteRule ^ /? [R=301,L] 问题解

我必须永久重定向所有URL:

http://www.example.com/?par=1248 (with and without the www)

使用.htaccess文件


我在上面使用的占位符“par”和“1248”可以是任何内容(字符、数字等)

这应该适合您并重定向您想要的URL:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /\?(.*)\ HTTP
RewriteRule ^ /? [R=301,L]

问题解决了!非常感谢您宝贵的回答。没问题,请随意做出正确的回答,以便与您有相同问题的其他用户知道您是如何解决问题的。
RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /\?(.*)\ HTTP
RewriteRule ^ /? [R=301,L]