wordpress - 如何使用 htaccess 隐藏原始图像路径
问题描述
我正在尝试从我的 WordPress 网站隐藏原始图像路径。在哪里不起作用。但其他规则工作正常。
我试过像
RewriteRule ^wp_unisol/img/([^/]+)$ wp_unisol/images/$1 [L]
但它不工作。
当我检查 .htaccess 检查器时,它显示为真。
我需要像下面这样的图像路径
原始路径: https ://clickthedemo.com/wp_unisol/images/noimgavailable.jpg
预期路径: https ://clickthedemo.com/wp_unisol/img/noimgavailable.jpg
我知道这个问题之前问过,但它没有帮助
解决方案
用这个:
RewriteEngine On
RewriteRule ^img/([^/]+)$ images/$1 [L]
并确保将其放在.htaccess
文件顶部或至少在 WordPress 重写规则之前。
推荐阅读
- xpath-2.0 - xpath 2.0 中缺少 let 的解决方法?
- laravel - 如何编写代码将多个数据插入数据库 Laravel
- php - 发生数据库错误错误号:1048
- dialogflow-es - 如何在对话流实现中将多个意图映射到一个处理程序?
- javascript - 处理放置在对象内的数组连接的更好方法
- android - APK 在 Android Studio 中安装后保持停止
- python - 将本地文件的大小与网络服务器上的文件进行比较?
- javascript - 如何在 LWC 中开玩笑测试闪电药丸
- django - Django:在 Django 中创建自定义字段时出错
- r - 在 RShiny 中按不同日期范围改变绘图