htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Does .htaccess go in root or htdocs?
PostPosted: 02 Oct 2006 02:13 
Offline
User avatar

Joined: 25 Sep 2006 04:48
Posts: 242
I currently have one .htaccess file associated with my simple site and it's located in the root directory, i.e., listed under the cgi-bin and htdocs entries in 'file explorer' as (shaded) .htaccess.

Is that where it's suppose to be, or is it suppose to be inside the htdocs folder?

All the .htaccess file does at this time is 'hotlink' protection.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: 02 Oct 2006 02:15 
Offline
User avatar

Joined: 25 Sep 2006 04:48
Posts: 242
Actually, it depends what is in your htaccess file.

In my root directory, the .htaccess is

Code:
AddHandler application/x-httpd-php .php .htm
Options -Indexes -ExecCGI -Includes -FollowSymLinks
DirectoryIndex index.htm index.html index.php


This specifies that my /htdocs/ and /cgi-bin/ and whatever other dirs I have in root, be subject to those rules.

Then in my /htdocs/.htaccess file I have the following
Code:
ErrorDocument 404 /inc/e/error.htm
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} !powweb\.com$
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteRule ^scripts/(.*)\.sll$ /cgi-bin/$1.php [T=application/x-httpd-php]



Note, not everything works from the root .htaccess.. and you should also realize that it is a bit more inefficient to use a htaccess file in your root dir.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB