在共享虚拟主机上,我的软件支持多个域(所有域指向相同的public_html根目录)。每个域都有自己的库(在库目录中)。由于多个域不可能在所有站点的同一目录中拥有自己的资源(例如图像),因此我有与每个HTTP主机名匹配的根目录。下面是目录结构的样子...
/public_html/
/public_html/.htaccess
/public_html/gallery/
/public_html/www.example1.com/gallery/topic_x/image.png
/public_html/www.example2.com/gallery/topic_y/image.jpg
/public_html/www.example3.com/gallery/topic_z/image.gif
对…的请求
http://www.example1.com/gallery/topic_x/image.png
要重写的...needs ...
/public_html/www.example1.com/gallery/topic_x/image.png
这需要使用.htaccess文件来完成。如上所述,在HTTP Host匹配目录中没有.htaccess文件(/public_html/www.example1.com/.htaccess不存在)。
我一直在尝试对以下内容进行多次修改……
RewriteEngine on
RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteRule ^(gallery)(/.+\.(gif|jpg|png))$ %{HTTP_HOST}$1$2 [L,NC]...without成功。
https://stackoverflow.com/questions/9320106
复制相似问题