Thanks in advance for any help you can provide on this issue! I manage a Ruby on Rails website that uses Apache and lives on Joyent's Cloud Server. Right now I have a pdf located at http://example.com/docs/mydoc.pdf . I'd like for this url to 301 redirect visitors to http://example.com/mydoc , which will be a webpage with the same content (instead of a pdf.)
I've tried a couple of methods for getting the redirect to take place, but neither are working.
- I went into VirtualMin and into the Apache server. Then, I chose Aliases / Redirects. Finally, I went under Permanent URL redirects and entered: FROM http://example.com/docs/mydoc.pdf TO http://example.com/mydoc and applied the changes.
- Since that didn't work, I went looking for an .htaccess file in my /public folder. None existed. So, I created an .htaccess file and added it to the /public folder. The only code in the file is
Redirect 301 /docs/mydoc.pdf http://example.com/mydoc
The problem? When I go to http://example.com/docs/mydoc.pdf, the redirect doesn't work.
I'm looking for the simplest way to add this 301 redirect and future 301 redirects to my website. Thanks again for your advice!