Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
htaccess-仅重写图像/css/js的url_Css_Regex_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

htaccess-仅重写图像/css/js的url

htaccess-仅重写图像/css/js的url,css,regex,apache,.htaccess,mod-rewrite,Css,Regex,Apache,.htaccess,Mod Rewrite,我想使用google drive将静态内容共享到我的站点。我如何使用htaccess来做到这一点?我只想重写图像、css和js文件的地址,所以根文件夹中的其余文件应该由主服务器提供 例如,我想重写 www.address.pl/template/mytemplate/image.jpg www.address.pl/template/mytemplate/css/some.css 致: googledrive.com/host/0B4ZBBXGYY4NRFVLVU5/image.jpg goog

我想使用google drive将静态内容共享到我的站点。我如何使用htaccess来做到这一点?我只想重写图像、css和js文件的地址,所以根文件夹中的其余文件应该由主服务器提供

例如,我想重写 www.address.pl/template/mytemplate/image.jpg

www.address.pl/template/mytemplate/css/some.css

致:

googledrive.com/host/0B4ZBBXGYY4NRFVLVU5/image.jpg

googledrive.com/host/0B4zbBxGUyY4NRFVlVU5/css/some.css


有可能吗?

您可以将此规则作为根目录中的第一条规则。htaccess:

RewriteEngine On

RewriteRule ^template/mytemplate/(.+)$ http://googledrive.com/host/0B4zbBxGUyY4NRFVlVU5/$1 [L,NC,R=301,NE]

提供更多css/js重定向的例子。添加在第一篇文章中。谷歌硬盘中的文件夹将始终保持不变。80%的文件都在这个文件夹www.address.pl/template/mytemplate/(或其中的子文件)中,所以应该足够开始了。对于其余的文件-如果我知道规则,我应该能够使其适应其余的文件夹