1

我需要覆盖

domain.com/image?f=images/subfolder/image.ext

domain.com/images/subfolder/image.ext

任何想法如何使用 htaccess 实现这一目标?

4

1 回答 1

1

通过启用 mod_rewrite 和 .htaccess httpd.conf,然后将此代码放在您.htaccessDOCUMENT_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]
于 2013-09-10T16:47:56.740 回答