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
Apache 使用重写规则从url中删除查询字符串_Apache_.htaccess_Rewrite - Fatal编程技术网

Apache 使用重写规则从url中删除查询字符串

Apache 使用重写规则从url中删除查询字符串,apache,.htaccess,rewrite,Apache,.htaccess,Rewrite,我正在试图重写htaccess文件中的url。 原始url: www.mywebsite.com/flash/module.swf?xmlpath=http%3a%2f%2f0.0.0%3a8000%2fconfig.xml 我想从此url中删除查询字符串。此条件应仅适用于.xml扩展名 输出URL应为 www.mywebsite.com/flash/module.swf您可以将查询字符串与RewriteCond和%{query_string}匹配。如果RewriteRule的第二个参数包含查询

我正在试图重写htaccess文件中的url。 原始url:

www.mywebsite.com/flash/module.swf?xmlpath=http%3a%2f%2f0.0.0%3a8000%2fconfig.xml

我想从此url中删除查询字符串。此条件应仅适用于.xml扩展名

输出URL应为


www.mywebsite.com/flash/module.swf

您可以将查询字符串与RewriteCond和%{query_string}匹配。如果RewriteRule的第二个参数包含查询字符串,它将覆盖现有的查询字符串。清除查询字符串就像添加一个?到您的url;-或者,您可以使用QSD查询字符串Discard标志

RewriteCond %{QUERY_STRING} \.xml$
RewriteRule ^flash/module\.swf$ flash/module.swf? [L]
如果希望将其改为外部重定向,请将标志[L]更改为[R,L]或[R=301,L]