Jump to content
Larry Ullman's Book Forums

Recommended Posts

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

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

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 file

I quote: ...This is the file that contains all the usernames and
encrypted passwords for your site.  It's extremely important that you place this file
outside 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

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

 Share

×
×
  • Create New...