如何添加日期查询字符串而不是时间

时间:2015-02-19 18:10:42

标签: .htaccess

htaccess将在网址末尾添加时间戳

RewriteCond %{QUERY_STRING} ^$
RewriteRule . %{REQUEST_URI}?%{TIME} [L,R=302,NE]

现在网址是

http://example.com/page1.html?20150219190231    
(year,month date - hour - minutes - seconds)

我喜欢url就像这样

http://example.com/page1.html?20150219
(Year , month ,date)

我尝试添加?%{Date},但这不起作用

RewriteCond %{QUERY_STRING} ^$
RewriteRule . %{REQUEST_URI}?%{TIME} [L,R=302,NE] 

1 个答案:

答案 0 :(得分:0)

你想:

RewriteCond %{QUERY_STRING} ^$
RewriteRule . %{REQUEST_URI}?%{TIME_YEAR}%{TIME_MONTH}%{TIME_DAY} [L,R=302,NE]