简体   繁体   English

RewriteRule在htaccess上不起作用

[英]RewriteRule not working on htaccess

I've tried my best over the past few days, but can't crack this. 过去几天,我尽了最大努力,但无法破解。 Grateful for any advise. 感谢任何建议。 Currently, our css files are on our server, eg http://www.yellowgiraffe.in/media/css/06427155c7973881a2250449796e95f1.css 当前,我们的css文件在我们的服务器上,例如http://www.yellowgiraffe.in/media/css/06427155c7973881a2250449796e95f1.css

Now we want the css to be picked up from the CDN (Akamai) http://css.yellowgiraffe.in/06427155c7973881a2250449796e95f1.css (on CDN) 现在,我们希望从CDN(Akamai)中提取CSS http://css.yellowgiraffe.in/06427155c7973881a2250449796e95f1.css (在CDN上)

Am putting down the relevant lines from htaccess below. 我从下面的htaccess放下相关行。 The "#" is intentional for the purpose of this post, and not a inadvertent slip “#”是用于此帖子的目的,并非疏忽大意

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
#RewriteLog "/var/log/rewrite.log"
#RewriteLogLevel 3
############################################
## you can put here your magento root folder
## path relative to web root
RewriteBase /
############################################
## workaround for HTTP authorization
## in CGI environment
RewriteRule ^media/css/(.*) http://css.yellowgiraffe.in/$1 [NC,R=301,L]

Post making the above changes to htaccess, when I run inspect browser, I still see the old URL. 对htaccess进行上述更改后,当我运行检查浏览器时,仍然看到旧的URL。 Fyi - To check the regex I used Scriptular Fyi-要检查正则表达式,我使用了Scriptular

Thanks in advance for any inputs 预先感谢您的任何投入

Correct me if I am wrong, but is the rewrite rule you want to use, the last line above? 如果我错了,请纠正我,但是您要使用的重写规则是上面的最后一行吗? It looks commented out with a single #. 它看起来已经用单个#注释掉了。 Maybe try removing that and restarting apache to make sure nothing is cached. 也许尝试删除它并重新启动apache以确保没有缓存任何内容。

http://eppand.com/how-to-comment-in-a-htaccess-file/ http://eppand.com/how-to-comment-in-a-htaccess-file/

Try: 尝试:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^media/css/(.*) http://css.yellowgiraffe.in/$1 [NC,R=301,L]
</IfModule>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM