Saturday, August 31, 2013

Old dev files still showing up? Redirect w .htaccess: RedirectMatch 301 /dev(.*) http://yoursite.com$1

I know this is nothing groundbreaking, but just a quick reminder for me. Sometimes I am very reluctant to delete files in a dev folder, but I don't want them available to the public, so that's where .htaccess comes in.

I had worked on a site that had a new design located in a "dev" subfolder while it was be Q&A'd and eventually we copied all the files into the root folder to go live with the new site. But... there was a lone rouge button still pointing to a page in the dev folder. instead of going through the site looking for any other links to dev pages, I used .htaccess to redirect any links to a page with /dev in the path to the same page in the root directory.

RedirectMatch 301 /dev(.*) http://yoursite.com$1

Yes, I should have done this in the first place, but you live and learn.



No comments:

Post a Comment