Reputation: 24385
So basically, I would like to know how to redirect all files within a directory to a page on my website. I would like to do this via my .htaccess
file.
I have a directory, directory1
, and it contacts many files.
I need to redirect all files within directory1
to www.mydomain.com/webpage.html
Is this possible?
Upvotes: 0
Views: 57
Reputation: 143926
You need to add this before any other rules in your htaccess file:
RewriteRule ^directory1/? http://www.mydomain/webpage.html [L,R=301]
Upvotes: 1
Reputation: 3186
Try using the 301 redirect first, it's the simplest and probably fastest method. Otherwise your solution will require mod_rewrite engine to be on.
Redirect 301 /directory1/(.*) http://www.mydomain/webpage.html
If that doesn't work try RedirectMatch, I haven't used either of these in a while myself so I'm just shooting from the hip by memory.
RedirectMatch 301 /directory1/(.*) http://www.mydomain/webpage.html
Upvotes: 1