apache - 使用 SSL 为子域设置 .access
问题描述
我在 /public_html/assets/api/images/api.php 或https://www.example.org/assets/api/images/api.php的主机中有一个脚本
现在我正在尝试使用通过https://images.example.org访问的 .htaccess 对其进行别名
我在 /home/mydomain/assets/api/images 中创建了一个 .htaccess,我在其中放置了以下代码:
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteEngine On
RewriteBase /
RewriteRule ^(.*) api.php?category=$2&id=$3&type=$4&size=$5&file=$6 [NC,QSA]
.htaccess 将接收具有以下语法的 url:
https://www.example.org/assets/api/images/products/87/flyer/md/c4Nrlh_WyrrS-SBEFzwl.png _
但它不起作用。字符串传递了空值,我得到:
类别=&id=&type=&size=&file=
完整的值只会转到 $1 字符串,而不会拆分为 $2、$3、$4...
产品/87/flyer/md/c4Nrlh_WyrrS-SBEFzwl.png
任何人都可以帮我修复它吗?谢谢!
解决方案
我让它工作了!
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteEngine On
RewriteBase /
RewriteRule ^([a-zA-Z_]+)/([0-9]+)/([a-zA-Z_]+)/([a-zA-Z]+)/([0-9a-zA-Z_-]+(\.(jpg|jpeg|png|gif))) api.php?&category=$1&id=$2&type=$3&size=$4&file=$5 [NC,QSA]
推荐阅读
- c - 寻找嵌套#ifdef-s 的替代方案
- java - 编组 SOAP 消息时避免重复命名空间
- android - Ionic 3 搜索栏可见键盘输入滞后于打字
- ios - 如何阻止计划的本地通知在特定日期后触发?
- sqlite - 具有多个查询选项的累积值
- asp.net - SQL Server:计算存储过程
- date - 长格式 (YYYYMMDDhhmmss.mmmuuun) 格式的 UTC 时间戳
- wordpress - TinyMCE 自 Worpress 4.9.6 起无法正常工作
- node.js - Firebase 函数找不到哈巴狗
- sql-server - 如何在使用 express4-tedious 在 express.js 中返回路由之前更改 JSON 结果