![WP Simple Download Monitor 文件下载 URL 重定向问题](https://linux22.com/image/573444/WP%20Simple%20Download%20Monitor%20%E6%96%87%E4%BB%B6%E4%B8%8B%E8%BD%BD%20URL%20%E9%87%8D%E5%AE%9A%E5%90%91%E9%97%AE%E9%A2%98.png)
在 .htaccess 文件中:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} =sdmon=software_download/software1.exe
RewriteRule ^index.php$ http://download.domain.com/software1.exe? [L,R=301]
RewriteCond %{QUERY_STRING} =sdmon=software_download/software2.exe
RewriteRule ^index.php$ http://download.domain.com/software2.exe? [L,R=301]
</IfModule>
这些规则重定向http:www.domain.com/index.php?sdmon=software_download/software1.exe
至http:www.domain.com/software1.exe
....
我的问题是:如何将两组规则合并为一组。
答案1
尝试这个:
RewriteCond %{QUERY_STRING} ^sdmon=software_download/software(\d+)\.exe$
RewriteRule ^index.php$ http://download.domain.com/software%1.exe? [L,R=301]
software1
这对、software5600
以及介于 之间的任何其他地方都有效。
编辑:
对于任何 exe 名称,请尝试以下操作:
RewriteCond %{QUERY_STRING} ^sdmon=software_download/([^/\.]+)\.exe$
RewriteRule ^index.php$ http://download.domain.com/%1.exe? [L,R=301]