【问题标题】:Redirect dynamic url to static url using htaccess使用 htaccess 将动态 url 重定向到静态 url
【发布时间】:2013-05-15 21:36:52
【问题描述】:

我有以下类型的动态网址。

http://example.com/interviews/sample1/data.xml
http://example.com/interviews/sample1234/data.xml
http://example.com/video/video-2/data.xml

在这里的采访中,sample1、sample1234、video、video-2...等都是动态名称。 我想将那些动态网址重定向到以下静态网址。

http://example.com/data.xml

问候

【问题讨论】:

    标签: .htaccess url redirect dynamic


    【解决方案1】:

    试试:

    RedirectMatch ^/.+/data.xml$ /data.xml
    

    或使用 mod_rewrite:

    RewriteCond %{REQUEST_URI} !^/data.xml$
    RewriteRule /data.xml$ /data.xml [L,R]
    

    【讨论】:

    • 优秀。我把 RedirectMatch ^/.+/data.xml$ /data.xml 工作得很好。你节省了我的时间。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多