如何使用 HTaccess 隐藏原始图像路径



我试图从我的WordPress网站隐藏原始图像路径。 无论它在哪里不起作用。 但其他规则是正常工作的。

我试过像

RewriteRule ^wp_unisol/img/([^/]+)$ wp_unisol/images/$1 [L]

但它不起作用。

当我检查.htaccess检查器时,它显示true。

我需要像波纹管这样的图像路径

原始路径:https://clickthedemo.com/wp_unisol/images/noimgavailable.jpg

加速路径:https://clickthedemo.com/wp_unisol/img/noimgavailable.jpg

我知道这个问题之前问过,但它没有帮助

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp_unisol/
RewriteRule ^img/([^/]+)$ images/$1 [L]
</IfModule>

将其放在wp_unisol目录中的.htaccess文件中。

使用这个:

RewriteEngine On
RewriteRule ^img/([^/]+)$ images/$1 [L]

并确保将其放在.htaccess文件的顶部或至少在WordPress重写规则之前。

最新更新