michiel Posted March 7, 2013 Share Posted March 7, 2013 I want to redirect a my site url to a directory on the server.. I ftp the site to a folder: html/myfiles...(not directly in the root, so that I can place other files there htaccess pswds etc)my host says I should use this code: RewriteEngine On Options +FollowSymlinks RewriteBase / RewriteCond %\{HTTP_HOST\} site.com RewriteCond %\{REQUEST_URI\} !^/html/? RewriteRule ^(.*)$ html/$1 [L] But when I place the htaccess file in the root (that is the area when I arrive when I ftp?)I get a internal server error. (site.com is an example) I tried mod alias aswell...It shouldn't be that hard? Link to comment Share on other sites More sharing options...
Larry Posted March 8, 2013 Share Posted March 8, 2013 Just to confirm, the "html" directory is in the Web root directory? And all your files are in there? And you're redirecting ALL requests to the "html" directory? Link to comment Share on other sites More sharing options...
michiel Posted March 8, 2013 Author Share Posted March 8, 2013 Yes. That is what I want (if thats a good idea?) Link to comment Share on other sites More sharing options...
Larry Posted March 8, 2013 Share Posted March 8, 2013 Well, it kind of doesn't make any sense. A more logical approach would be just to change the Web root directory to HTML. An even more logical approach would be to put all your files in the main directory. What is the thinking that got you to this point? What is it you were hoping to accomplish? Link to comment Share on other sites More sharing options...
michiel Posted March 8, 2013 Author Share Posted March 8, 2013 The idea I had was this:have the website in a directory (in this case called html, but it could be named anything.) and put other files 'above' it, namely the .htpasswd fileI quote: ...This is the file that contains all the usernames andencrypted passwords for your site. It's extremely important that you place this fileoutside of the web root. You should only be able to access it by FTP,not over the web... Link to comment Share on other sites More sharing options...
Larry Posted March 8, 2013 Share Posted March 8, 2013 Okay, but, first, why do you need an .htpasswd file at all? And, second, just using a redirect doesn't change the Web root directory, so using an .htaccess like you're proposing doesn't actually result in .htpasswd being outside of the Web root directory. And, third, you should be able to put the .htpasswd somewhere else already. And, fourth, if you're using a hosted site, there's undoubtedly a control panel for you to password protect directories, so you don't have to meddle with the .htpasswd yourself at all. Link to comment Share on other sites More sharing options...
michiel Posted March 8, 2013 Author Share Posted March 8, 2013 Ok, maybe I'm just making it unnessarily difficult for myself. Thanks for your reply. Link to comment Share on other sites More sharing options...
Larry Posted March 8, 2013 Share Posted March 8, 2013 Sure thing. Good luck and let us know if you have any more questions. Link to comment Share on other sites More sharing options...
Recommended Posts