Forum Moderators: phranque
Redirect 301 /dircetory_name/ [domain.com...]
How can I modify this to also include requests for: /dircetory_name (without the trailing slash)? Thanks
/directory_name(.*)
This will remove the trailing slash and will also send any users who request files within the directory to go to your new content location. so you could use...
RedirectMatch permanent ^/directory_name(.*) [domain.com...]
That should work ok.
Mack.
Thanks Mack, worked great.
I added it next to another redirect:
RedirectMatch (.*)\.file_type [domain.com...]
How would I change this one to have the same form, or doesn't it matter? (Just thought it would be better to keep the language similiar.)
Not sure exactly what you are trying to do with the second example. :)
I think youre trying to specify that all files within the directory go to the domain is this correct.
The snipped I used in my above post shoudl be up to the job.
General I use that method when I hange a directory name or location, Either pass users to the homepage if the directory no longer exists or to the new location and directry name.
Sorry if I picked your post up wrong. If so feel free to try me again :)
Mack.
Hi mack,
In the past, I had a certain file_type that was located from several directories. I have removed this file_type, but 2 years later I still see dozens of requests in my error logs. This redirect sucessfully sent these requests to my home page, instead of my error page:
RedirectMatch (.*)\.file_type [domain.com...]
My question was, should I change it to a similiar syntax as the code you suggested above? My thinking is that all RedirectMatch rules should follow similiar language. Thanks.
Excellent, works perfect. Thanks Jim
Since 301 translates to "permanent", wouldn't this also be correct?
RedirectMatch 301 ^/directory_name [domain.com...]
RedirectMatch 301 \.file_type$ [domain.com...]