I am not able to change the URL in css file; by using mod_rewrite in apache
The URL is in bold letters where I want to make change... It should be rewritten to url /csmmail/lib/webmail/folderTree.gif
Following is the html snippet...
<link href="/csmmail/lib/webmail/folderTree.css?v=bfb38b233d72ba6a690a39394d7c964f" type="text/css" rel="stylesheet">
x_2az UL, x_2az LI {
list-style-type: none;
margin: 0px;
white-space: nowrap;
}
x_2az UL {
padding: 0px 0px 0px 16px;
}
x_2az LI {
padding: 1px 0px 1px 0px;
}
x_2az IMG {
vertical-align: middle;
}
.x_2le {
margin-right: 3px;
}
.x_2bq {
vertical-align: bottom;
margin-left: 0px;
}
.x_2lf {
background: ***url(/lib/webmail/folderTree.gif***) no-repeat;
padding: 2px 0 3px 16px;
}
sprite_folder {
}
I am new to mod_rewrite; I have tried by using in per directory开发者_StackOverflow中文版 conf file.
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_REFERER} \.(css)$
RewriteRule ^/lib/webmail/folderTree\.gif$ /csmmail/lib/webmail/folderTree.gif [NC]
I think you're doing it wrong, just do :
RewriteRule ^/lib/webmail/folderTree\.gif$ /csmmail/lib/webmail/folderTree.gif
You can't really rely on HTTP_REFERER since all browser does not set it.
You are expecting the HTTP_REFERRER to match your .css file.
I guess you are expecting this because you have reference the image in your css file? This is an incorrect assumption.
The referrer will always be the actual page that was loaded in your browser, not the css page.
You can confirm this by using a HTTP sniffing tool like fiddler - http://www.fiddler2.com/fiddler2/
Try dropping the rewrite condition to see if that works.
精彩评论