is .htaccess necessary on a website?

Discussion of non-phpBB related topics with other phpBB.com users.
Forum rules
General Discussion is a bonus forum for discussion of non-phpBB related topics with other phpBB.com users. All site rules apply.
User avatar
noth
Registered User
Posts: 2528
Joined: Fri Jan 07, 2005 7:10 pm
Location: North Surrey

is .htaccess necessary on a website?

Post by noth »

I had a image failure problem on my normal webpages today

my host replied
Good morning.

The failure you are seeing is being caused because you appear to have configured a secured login within an .htaccess file in the /public_html/p/pimages/ folder but have not specified any authorised username/password combination for this - The result is that the server attempts to secure access to images within the folder but cannot do so as there is no legitimate user which is allowed access and so results in an error, causing content within the folder to not display.
On the assumption that this folder should not be secured (as with it secured a visitor would need to enter a username/password when visiting pages on your website which contain images) I have simply removed the partially-setup protection on the folder, and your images are now displaying correctly.

Best Regards

Alex
I don't understand why any of my webpages should have an htaccess, is it a matter of opinion? I removed the htaccess file entirely after getting that reply and the page then seemed to resolve at lightning speed!

Do other people like having .htaccess?? if so, why?

I looked at another htaccess file on my site, it reads

Code: Select all

<FILES "*.html">
ForceType 'text/html; charset=UTF-8'
</FILES>
DirectoryIndex index.php 

AuthUserFile  /home/p/public_html//.htpasswd
AuthGroupFile /home/p/public_html//.htgroup

AuthName "Protected Area"
AuthType Basic

<FILES .htpasswd>
deny from all
</FILES>

<FILES .htgroup>
deny from all
</FILES>   
now from that I understand it commands that text be used charset=UTF-8' and the home page set to index.php as for the rest of it I have no clue and that is an htaccess in my root folder, why would anybody have even further htaccess files in images folders or elsewhere? I'm talking about a normal website that just shows a few text articles on a page with accompanying images, no logging in/ out editing/ deleting

should you have them in more of your folders for security? I am interested in other web owners' views on this, cheers! 8-)
cleverwise
Registered User
Posts: 37
Joined: Fri Feb 28, 2014 10:55 pm
Location: Atlanta, GA
Name: Jeremy

Re: is .htaccess necessary on a website?

Post by cleverwise »

The .htaccess is not required for having a general website. That file simply allows you to make changes in the way your website behaves for example banning people from accessing your site or redirecting an old dead link to a new page.

Some software like Wordpress requires settings in the .htaccess file (or httpd.conf). However assuming you aren't running software that requires special changes you don't have to use that file.
User avatar
Alien_Time
Registered User
Posts: 389
Joined: Fri Dec 31, 2010 7:08 am

Re: is .htaccess necessary on a website?

Post by Alien_Time »

If you dont need it, dont have it. Less work for the server since it doesnt need to parse the file each time. Only use it if you need to override some server settings or add some rewrite rule then .htaccess will be useful for newbies.
User avatar
noth
Registered User
Posts: 2528
Joined: Fri Jan 07, 2005 7:10 pm
Location: North Surrey

Re: is .htaccess necessary on a website?

Post by noth »

what is a rewrite rule? easy example please? :D
User avatar
Lumpy Burgertushie
Registered User
Posts: 69228
Joined: Mon May 02, 2005 3:11 am

Re: is .htaccess necessary on a website?

Post by Lumpy Burgertushie »

not too many "easy examples" for rewrite rules. best thingwould be to do a google search for htacceess rewrite.

another use for htaccess is to make sure the server is showing the default file that you wish.

for instance, if you created a new home page named home.php

you could put this line in your htaccess file and it would become the default page shown when someone accessed your domain name.

DirectoryIndex home.php index.php

or whatever file name you would wish to be the default page when people do not put a page name in the url.

for instance, yourdomain.com/index.php will take you to the index.php page.
normally, yourdomain.com will also take you to the index.php page.

however, if you have the line above in your htaccess file and you have a file named home.php in the same place as your file named index.php, it will show the home.php file whenever someone types in simply yourdomain.com



luck,
robert

Return to “General Discussion”