.htaccess or htaccess.txt

Discussion regarding Joomla! 1.5 security issues.
Joomla! Vulnerable Extensions: http://feeds.joomla.org/JoomlaSecurityV ... Extensions

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Security Checklist
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
chuckles
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Tue Feb 26, 2008 1:10 pm

.htaccess or htaccess.txt

Post by chuckles » Fri Jun 13, 2008 2:01 pm

Ok, I've been reading all over the place and can't find an answer to this question.

What is the difference between the htaccess.txt file which comes as standard with J! and the .htaccess file which you are supposed to rename it to under certain circumstances.

Should I always rename it to .htaccess? When should I keep it called htaccess.txt?

As I say I've read the security links I've seen around here and they mention .htaccess all the time, but there's nothing specific as to what situations to use either file

Thanks

User avatar
brad
Joomla! Master
Joomla! Master
Posts: 13272
Joined: Fri Aug 12, 2005 12:38 am
Location: Australia
Contact:

Re: .htaccess or htaccess.txt

Post by brad » Fri Jun 13, 2008 2:05 pm

Rename htaccess.txt to .htaccess
This is the designed behavior.

BTW try using the Google search above.. I entered 'htaccess.txt' then I click on the documentation refinement tag and look what you have:

http://docs.joomla.org/Administration_FAQs
http://docs.joomla.org/Security_and_Performance_FAQs
http://docs.joomla.org/Screen.config.15

All the best.

doc_flake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 147
Joined: Fri Mar 21, 2008 9:26 pm
Location: Bad Schwartau / Lubeck, Germany

Re: .htaccess or htaccess.txt

Post by doc_flake » Fri Jun 13, 2008 6:02 pm

One explanation in addition to Brad's documentation:
The file is only in effect if it has the name .htaccess (some special name that has nothing to do with J! at all). The htaccess.txt is something like a master copy to this file that may be changed or completed by experienced users before renaming it.

Sometimes, there already is a .htaccess file in effect in your root folder prior to installation. (Actually, that is probably the reason for Joomla's file not having the name .htaccess in the first place. Otherwise the old file would be overwritten.) If that is the case, it might contain some provider-specific lines that have to be added to Joomla's file before it replaces the old one.

Bye,
Martin

chuckles
Joomla! Apprentice
Joomla! Apprentice
Posts: 31
Joined: Tue Feb 26, 2008 1:10 pm

Re: .htaccess or htaccess.txt

Post by chuckles » Fri Jun 13, 2008 8:35 pm

Thanks both for the replies. Both are helpful. The documentation is very overwhelming as much of it refers to versions pre 1.5, so I don't know how much of it is still relevant.

I have renamed the file accordingly, so that's a start :)

User avatar
Darling
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu Aug 20, 2009 5:27 am
Location: Virginia

Re: .htaccess or htaccess.txt

Post by Darling » Thu Aug 20, 2009 5:29 am

So helpful, thanks guys! I finally have SEF urls.
http://docs.joomla.org/SEF_URLs_in_Joomla!_1.5
I am trying to teach myself Joomla, welcome any advice
currently using yootheme WayBeyond

Larry71
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Feb 15, 2010 12:00 pm

Re: .htaccess or htaccess.txt

Post by Larry71 » Mon Feb 15, 2010 12:57 pm

One of the main reasons for there being an htaccess.txt file in most cases is because the Windows operating system will not allow you to create an ,htaccess file. There has to be a file name in front of an extension, according to Windows error message dialogs.

There are ways to get around that. In Notepad, I think you just place the name in quotes, as in ".htaccess" or better yet use any number of third-party NotePad replacements. MetaPad is a good one. Then just name the file ,htaccess.

.htaccess is a hidden system file in Unix, Linux and Apple OSX. I just read somewhere that in Apple you cannot even access a system file, and therefore you must keep an editable copy called htaccess.txt, make changes and save the htaccess.txt, then save again as .htaccess.

In Linux and Unix, filenames that begin with a dot are hidden files, usually also system files. But you can show hidden files and folders, and edit them. Naturally, the user is cautioned to have a good reason to edit a system file, and know a little something about what it does before slogging away. Next thing might be a computer that will not run anymore!

The Apache server uses .htaccess if the httpd.conf is configured to allow it, and that configuration is under the control of the web host, unless you have your own dedicated server.. Some Web hosts do not permit use of ,htaccess, which overrides configuration settings in the server httpd.conf.

While .htaccess is neither a hidden file nor a system file in Windows, an Apache server still uses it as a server configuration file.

A Windows IIS server does not use .htaccess. It has its own ways of doing things.

Never upload a copy of your Apache server's ,htaccess file with the htaccess.txt file name. That makes your server configuration settings a matter of public record, just like any other text document posted to the site. If you must upload your .htaccess file as htaccess.txt, immediately rename the server copy to .htaccess.

I know I'm a little late coming in on this thread, but because it still is high in the search results, it still provides useful information to people searching for things.

User avatar
PhilD
Joomla! Hero
Joomla! Hero
Posts: 2737
Joined: Sat Oct 21, 2006 10:20 pm
Location: Wisconsin USA
Contact:

Re: .htaccess or htaccess.txt

Post by PhilD » Mon Feb 15, 2010 6:45 pm

The reason that Joomla names the file htaccess.txt is so that it does not overwrite any existing .htaccess files that may be present in the desired install directory. As Brad said, this is designed behavior. It is up to the person in control of the site to determine if something needs to be added to the Joomla htaccess file (such as an existing 301 redirect to a subdirectory) before it is enabled.
PhilD

User avatar
mandville
Joomla! Master
Joomla! Master
Posts: 15152
Joined: Mon Mar 20, 2006 1:56 am
Location: The Girly Side of Joomla in Sussex

Re: .htaccess or htaccess.txt

Post by mandville » Mon Feb 15, 2010 10:59 pm

I am going to try and correct/explain some popular misconceptions/beliefs over this very powerful .htaccess file with no offence to larry71 who just covered the subject
Larry71 wrote:Windows operating system will not allow you to create an ,htaccess file.
i have not known a windows server to use a .htaccess file nativley.
There are ways to get around that. In Notepad, I think you just place the name in quotes, as in ".htaccess"
wil sometimes work on older IIS systems
.htaccess is a hidden system file in Unix, Linux and Apple OSX. I just read somewhere that in Apple you cannot even access a system file, and therefore you must keep an editable copy called htaccess.txt, make changes and save the htaccess.txt, then save again as .htaccess.
you could just zauthfile it to save time but i am not a MAC user.

In Linux and Unix, filenames that begin with a dot are hidden files, usually also system files. But you can show hidden files and folders, and edit them. Naturally, the user is cautioned to have a good reason to edit a system file, and know a little something about what it does before slogging away. Next thing might be a computer that will not run anymore!
The Apache server uses <snip>
thats a miss-match of several different copy and paste items. you can also count vps in that paragraph
an Apache server still uses it as a server configuration file.
if its named correctly.
A Windows IIS server does not use .htaccess.
as you have already said.
Never upload a copy of your Apache server's ,htaccess file with the htaccess.txt file name. That makes your server configuration settings a matter of public record, just like any other text document posted to the site. If you must upload your .htaccess file as htaccess.txt, immediately rename the server copy to .htaccess.
can we clarify that where you have put ,htaccess you actually mean .htaccess. it is always recommended to rename the htaccess.txt to .htaccess on site setup. the reasons it has the .txt extension has already been explained, along with the fact cpanel forces a .htaccess creation on account creation. in addition if you want to know what a joomla site has as an htaccess.txt, just download it from joomla. I wuld assume that any changes you make to your .htaccess would be done directly and not by uploading and then renaming the file.
I hope the OP question has now been answered/explained and some people have learned things.

anyone curious on joomla and IIS then see http://forum.joomla.org/viewforum.php?f=543
HU2HY- Poor questions = Poor answer
Un requested Help PM's will be reported, added to the foe list and possibly just deleted
{VEL Team Leader}{TM Auditor }{ Showcase & Security forums Moderator}


Locked

Return to “Security in Joomla! 1.5”