Apache mod_rewrite用于捕获XML请求

时间:2021-01-21 16:56:27

How do I create a apache RewriteRule that catches any request URL ending in .xml, strips off the .xml and passes it to a specific script?

如何创建一个apache RewriteRule来捕获以.xml结尾的任何请求URL,剥离.xml并将其传递给特定的脚本?

http://www.example.com/document.xml, becomes http://www.example.com/document passed to script.php

1 个解决方案

#1


2  

This should do the trick, I believe.

我相信这应该可以解决问题。

RewriteRule ^(.+)\.xml$ script.php?path=$1

#1


2  

This should do the trick, I believe.

我相信这应该可以解决问题。

RewriteRule ^(.+)\.xml$ script.php?path=$1