我有一些网站的旧.swf
个文件/链接,目前它们位于404 Not Found
页面。
我想知道是否有一种简单的方法,使用.htaccess
(或您推荐的任何其他方法)将这些文件/链接重定向到我的网站首页http:www.mysite.com/home
。
示例链接:
http://www.mysite.com/folder/file.swf
http://www.mysite.com/file.swf
答案 0 :(得分:6)
这应该有效:
RewriteEngine On
RewriteRule ^.*\.swf$ /home [R=301,L]
答案 1 :(得分:0)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite\.com/(.*).swf$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com [R=301,L]
答案 2 :(得分:0)
如果您想将所有swf文件永久重定向到www.mysite.com/home,可以使用.htaccess文件。
首先,你必须在apache中启用mod_rewrite。
然后将以下内容添加到.htaccess文件中:
Options +FollowSymlinks
RewriteEngine on
Rewriterule ^mysite\.com/(.*).swf$ http://www\.mysite\.com/home [R=301,NC,L]