The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> how to use a .htaccess file?
allenph
post Mar 3 2012, 09:32 AM
Post #1


Novice
**

Group: Members
Posts: 21
Joined: 15-February 12
Member No.: 16,477



So i inserted a blank index file into my site to block out sensitive file names...but then I realized anyone could look at the source code and enter the path directly into the address bar. I'm attempting to use a .htaccess file but with no luck. seems no matter what script I put in there nothing happens. I made a .htaccess file on windows by making a file called htaccess.txt then renaming it with cmd to .htcaccess because windows yells that you have to have a file extension if you do it any other way. I put my script in the root directory of my site it was...
<Files ~ "\.(txt)$">
order allow,deny
deny from all
</Files>
if i'm correct that should make it so no one can see my .txt files. thing is it does absolutely nothing...help!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Ephraim F. Moya
post Mar 3 2012, 06:48 PM
Post #2


Advanced Member
****

Group: Members
Posts: 167
Joined: 2-September 07
From: New Mexico
Member No.: 3,702



QUOTE(allenph @ Mar 3 2012, 07:32 AM) *

So i inserted a blank index file into my site to block out sensitive file names...but then I realized anyone could look at the source code and enter the path directly into the address bar. I'm attempting to use a .htaccess file but with no luck. seems no matter what script I put in there nothing happens. I made a .htaccess file on windows by making a file called htaccess.txt then renaming it with cmd to .htcaccess because windows yells that you have to have a file extension if you do it any other way. I put my script in the root directory of my site it was...
<Files ~ "\.(txt)$">
order allow,deny
deny from all
</Files>
if i'm correct that should make it so no one can see my .txt files. thing is it does absolutely nothing...help!


Does your host allow .htaccess files?

Is AllowOverride === none?

This post has been edited by Ephraim F. Moya: Mar 3 2012, 06:58 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
allenph
post Mar 4 2012, 12:08 AM
Post #3


Novice
**

Group: Members
Posts: 21
Joined: 15-February 12
Member No.: 16,477



QUOTE(Ephraim F. Moya @ Mar 3 2012, 06:48 PM) *

QUOTE(allenph @ Mar 3 2012, 07:32 AM) *

So i inserted a blank index file into my site to block out sensitive file names...but then I realized anyone could look at the source code and enter the path directly into the address bar. I'm attempting to use a .htaccess file but with no luck. seems no matter what script I put in there nothing happens. I made a .htaccess file on windows by making a file called htaccess.txt then renaming it with cmd to .htcaccess because windows yells that you have to have a file extension if you do it any other way. I put my script in the root directory of my site it was...
<Files ~ "\.(txt)$">
order allow,deny
deny from all
</Files>
if i'm correct that should make it so no one can see my .txt files. thing is it does absolutely nothing...help!


Does your host allow .htaccess files?

Is AllowOverride === none?


It is just a apache webserver running on local host at the moment. I'm getting good at the actual programming but the server stuff is new and I suck at it. I really don't know what you mean.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Mar 4 2012, 01:21 AM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



OK, do you allow .htaccess then? That is specified in the httpd.conf file. It's been a while, I think there are a couple of directives to look at, but the most important of them is AllowOverride. If that's set to 'none' .htaccess directives won't have any effect.

Have you tried other stuff in your .htaccess and do they work? I don't remember the <Files> syntax, but what you have looks right to me - which doesn't mean it is, my memory is a sieve. blush.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th March 2024 - 09:39 PM