I moved a file (file.pdf) from the root of my web directory into a folder called “myfiles”. In order to not break existing links and bookmarks, I am looking to setup a rewrite rule so that:
http://www.domain.tdl/file.pdf will redirect to http://www.domain.tdl/myfiles/file.pdf
The rewrite rule should work whether you include “www” or not.
Also, my website has a second domain (domain2.tdl). What is the best way to write this rule so that it will work for domain.tdl and domain2.tdl?
Thanks for your help!
Assuming you use htaccess, this should do:
This means that every PDF that is required from the root will be retrieved from the myfiles folder…