2015-10-13 76 views
-2

很好,我想重寫JS:阿帕奇:重寫JS刪除時間戳

/resources/js/general.js/1234/ -> /resources/js/general.js 

由於Akamai的緩存,我不能使用常規的查詢字符串:T = 1234

靜態作品:

RewriteRule ^(.*)\.js/[0-9]+/$ /resources/js/general.js [NC,L] 

,但我不能建立一個動態的正則表達式:(

RewriteRule ^(.*)\.js/[0-9]+/$ $1 [NC,L] 

結果:

/resources/js/general 

很好,但:

RewriteRule ^(.*)\.js/[0-9]+/$ $1.js [NC,L] 

結果:

/resources/js/general.js/1234/ 

和:

RewriteRule ^(.*)\.js/[0-9]+/$ $1\.js [NC,L] 

個結果:

/resources/js/general.js/1234/ 

謝謝:)

編輯與所有的.htaccess:

AddCharset UTF-8 .php 
Options +Includes 
XBitHack on 
RewriteEngine on 

# works static 
#RewriteRule ^(.*)\.js/[0-9]+/$ /resources/js/general.js [NC,L] 
# not dynamic 
RewriteRule ^(.*)\.js/[0-9]+/$ $1.js [NC,L] 
+0

它重定向對: 'http:// domain/home/projects/proyectName/public_html/resources/js/general.js'我不需要重定向,ia重寫需要顯示js的內容 – ZiTAL

+0

使用.htacces編輯帖子,但是唯一一個 – ZiTAL

+0

我想在「/resources/js/general.js」中重寫「/resources/js/general.js/1234/」,例如 – ZiTAL

回答

1

此規則替換您的重寫規則:

RewriteRule ^(.+?\.js)/\d+/?$ /$1 [NC,L]