我想重写这个:
index.php?action=dlattach;topic=2745.0;attach=14374;image对此:
attachments/opening-inauguracion-png.14374/到目前为止,我已经建造了但没有用的是:
RewriteRule ^index\.php?=dlattach;topic=([0-9]+);attach=([0-9]+);image /attachments/$2/ [R=301,L]发布于 2014-02-28 03:03:55
要操作查询字符串,需要在%{QUERY_STRING}中使用重写条件
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} attach=([0-9]+) [NC]
# if you need a more exact match of your current query string
# comment the above RewriteCond and uncomment the below RewriteCond
#RewriteCond %{QUERY_STRING} ^action=dlattach;topic=[0-9\.]+;attach=([0-9]+);image$ [NC]
RewriteRule ^index.php$ attachments/opening-inauguracion-png.%1/ [R=302,NC,L]而且,只在您确认该规则正在工作时才将其更改为301,以避免在测试规则时缓存浏览器,如果规则不能正常工作以减轻该规则的影响,则该规则可能会很糟糕。
发布于 2014-02-28 03:19:23
我认为你的意思是相反的:
RewriteEngine On
RewriteRule ^attachments/opening-inauguracion-png.([0-9]+)$ /index.php?action=dlattach;topic=2745.0;attach=$1;image [R=301,L]https://stackoverflow.com/questions/22085326
复制相似问题