Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/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将xml文件的文件名作为var传递给生成php文件的sitemap_Php_Regex_.htaccess - Fatal编程技术网

使用htaccess将xml文件的文件名作为var传递给生成php文件的sitemap

使用htaccess将xml文件的文件名作为var传递给生成php文件的sitemap,php,regex,.htaccess,Php,Regex,.htaccess,我想让一个xml文件名重定向到一个php文件,传递文件名,而不将xml作为变量追加。因此,如果文件名是something.xml,它将传递到一个php文件并传递一个变量:something 示例(顶部为原始URL;底部为新URL): 所以用户CBroe恐吓我自己去解决这个问题。在这个解决方案中,我从文件夹zm中的xml文件进行定向,因为我希望这个规则不会影响根目录中已有的其他xml文件 RewriteEngine On RewriteRule ^zm/([\w-]+)\.xml$ /files

我想让一个xml文件名重定向到一个php文件,传递文件名,而不将
xml
作为变量追加。因此,如果文件名是
something.xml
,它将传递到一个php文件并传递一个变量:
something

示例(顶部为原始URL;底部为新URL):


所以用户CBroe恐吓我自己去解决这个问题。在这个解决方案中,我从文件夹zm中的xml文件进行定向,因为我希望这个规则不会影响根目录中已有的其他xml文件

RewriteEngine On

RewriteRule ^zm/([\w-]+)\.xml$ /files/sitemapper.php?var=$1 [L,QSA,NC]

这是最基本的重写了,所以你肯定想让我们看看?他并没有“吓唬”你。他要求你遵守这个网站的规则。请特别注意“如何提问”下的第二个要点,我不知道规则。很抱歉我的“恐吓”评论只是想作为一种顽皮的语言,以确认我因不够努力而被逮捕。我一开始就这样寻找答案。没有找到它,我想我会“为事业贡献力量”来发布这个问题。再一次,我认为我只是打破了一个社会标准,一开始我并没有更多地独自与它搏斗。我不知道有什么规则。现在我知道了。谢谢你通知我。
RewriteEngine On

RewriteRule ^zm/([\w-]+)\.xml$ /files/sitemapper.php?var=$1 [L,QSA,NC]