我需要覆盖
domain.com/image?f=images/subfolder/image.ext
到
domain.com/images/subfolder/image.ext
任何想法如何使用 htaccess 实现这一目标?
我需要覆盖
domain.com/image?f=images/subfolder/image.ext
到
domain.com/images/subfolder/image.ext
任何想法如何使用 htaccess 实现这一目标?
通过启用 mod_rewrite 和 .htaccess httpd.conf
,然后将此代码放在您.htaccess
的DOCUMENT_ROOT
目录下:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+image\?f=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=301,L]
RewriteRule ^(images/.+)$ /image?f=$1 [L,QSA,NC]