有没有一种方法可以访问文件夹中的所有图像:
www.example.com/image/通过如下的URL:
static.example.com/image/例如,图像
www.example.com/image/hello.jpg只能通过以下方式访问:
static.example.com/image/hello.jpg发布于 2013-07-17 00:48:24
为映像设置一个虚拟名称主机,并将Alias / static.example.com /设置为所需的目录。
然后在虚拟主机中为www.example.com和Deny访问它设置一个<Location>部分。
发布于 2013-07-17 14:10:14
假设您已经创建了子域:static.example.com。
在www.example.com主机上,通过httpd.conf启用mod_rewrite和.htaccess,然后将以下代码放入DOCUMENT_ROOT目录下的.htaccess中:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?\.example\.com$ [NC]
RewriteRule ^(image(?:/.*|))$ http://static.example.com/$1 [L,R=301,NC]https://stackoverflow.com/questions/17682407
复制相似问题