Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.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
Apache .htaccess重定向哪个不';没有来自根的查询字符串和第一级_Apache_.htaccess_Mod Rewrite_Redirect - Fatal编程技术网

Apache .htaccess重定向哪个不';没有来自根的查询字符串和第一级

Apache .htaccess重定向哪个不';没有来自根的查询字符串和第一级,apache,.htaccess,mod-rewrite,redirect,Apache,.htaccess,Mod Rewrite,Redirect,我想重定向没有/?查询字符串到如下所示的查询字符串 到 只需要一个斜杠级别的重定向,比如:或 不想像这样重定向: 请帮我写这篇文章,我写得不太好 谢谢。您可以在root.htaccess中使用此规则: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^((?!index\.html)[^/]+)/?$ /?id=$1 [L,QSA,NC]

我想重定向没有/?查询字符串到如下所示的查询字符串

只需要一个斜杠级别的重定向,比如:或

不想像这样重定向:

请帮我写这篇文章,我写得不太好


谢谢。

您可以在root.htaccess中使用此规则:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^((?!index\.html)[^/]+)/?$ /?id=$1 [L,QSA,NC]
谢谢你Anubhava:),这是我在重定向结束时得到index.html的最后一个请求,比如:id=index.html当我访问根域时,我可以排除index.html domain.com并将其重定向到me domain.com吗?id=index.html不想在域的根上重定向。再次感谢您的大力帮助:)