.htaccess 使用htaccess将动态url重定向到静态url
我有以下类型的动态URL.htaccess 使用htaccess将动态url重定向到静态url,.htaccess,url,redirect,dynamic,.htaccess,Url,Redirect,Dynamic,我有以下类型的动态URL 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等都是动态名称。 我想将那些动态url重定向到下面的静态url http://example.com/data.x
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等都是动态名称。
我想将那些动态url重定向到下面的静态url
http://example.com/data.xml
关于请尝试:
RedirectMatch ^/.+/data.xml$ /data.xml
或者使用mod_重写:
RewriteCond %{REQUEST_URI} !^/data.xml$
RewriteRule /data.xml$ /data.xml [L,R]
杰出的我把RedirectMatch^/+//data.xml$/data.xml放在一起运行得很好。你节省了我的时间。谢谢!