Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess redirect file type

I have some old .swf files/links for a website and they currently lead to a 404 Not Found page. I was wondering if there was a simple way, using .htaccess (or any other method you may recommend) to redirect these files/links to my websites homepage http:www.mysite.com/home.

Example links:

http://www.mysite.com/folder/file.swf

http://www.mysite.com/file.swf

like image 855
PapaSmurf Avatar asked Jun 08 '12 13:06

PapaSmurf


People also ask

What is a 301 .htaccess redirect?

What Is a 301 Redirect? A 301 redirect is a permanent redirect. When a user tries to access an old URL, the server sends their browser the 301-Permanently Moved status code and sends them to another page. This is useful for site owners and users because it means they are directed to the next most relevant page.

What is RewriteEngine on htaccess?

htaccess rewrite rules can be used to direct requests for one subdirectory to a different location, such as an alternative subdirectory or even the domain root. In this example, requests to http://mydomain.com/folder1/ will be automatically redirected to http://mydomain.com/folder2/.


1 Answers

This should work:

RewriteEngine On

RewriteRule ^.*\.swf$ /home [R=301,L]
like image 169
John Lawrence Avatar answered Sep 30 '22 20:09

John Lawrence