Go Back   Computer Forums > General Computing > Server Administration
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 02-15-2009, 05:42 PM   #1
Jk
In Runtime
 
Jk's Avatar
 
Join Date: Jan 2006
Posts: 236
Default .htaccess doesn't work

Well, I got bored and decied to try and make a 404 page on my server. Google made it seem really easy. I just have to edit my .htaccess and tell it to open a certain html file when it encounters a 404. I didn't have a .htaccess in my root folder so I made a blank file and named it .htaccesss. I pasted this in the file.

ErrorDocument 404 /404page.html

I saved it and then made a html file with some text in it and saved it as 404page.html. I opened a ssh and ran "sudo chmod 644 .htaccess" to make sure permssions were correct. I also restarted apache for good measure.

I go to a page that doesn't exist and I get the regular 404 error. Does anyone know why this didn't work for me? This is not the first time I had problems with .htaccess. I tried to password protect a folder before using .htaccess and I couldn't do it. I just assumed that it was something I did wrong and forgot about it. I'm guessing apache isn't looking for .htaccess or something, is there something I have to enable in apache2.conf or httpd.conf?

I am running apache 2.2.8 on xubuntu.
__________________

__________________
Evga 680i SLI Mobo | C2d 6420 @ 3.2 | 2gb RAM | 9800gtx | Corsair 750w | Pioneer DVD Writer | 330gb | Antec 300
Ubuntu 9.04 | Windows 7

I miss my opty :c
Jk is offline   Reply With Quote
Old 02-18-2009, 07:40 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,007
Default Re: .htaccess doesn't work

I believe (though I may be wrong).

the .htaccess files are no longer used when just left in folders, some people may choose to switch this option on, but for speed and efficiency generic tasks like this are controlled in the httpd.conf and related files.

if it's your own server then there is a chance that you can switch on the option to use htaccess files, if it's a shared server either bought or free from a hosting company you may not have this option.
__________________

__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 02-18-2009, 07:16 PM   #3
Jk
In Runtime
 
Jk's Avatar
 
Join Date: Jan 2006
Posts: 236
Default Re: .htaccess doesn't work

I checked out my httpd.conf and my apache2.conf. Httpd.conf was there but it was empty. Apache2 has some settings but I didn't see any that were related to what I am trying to do. Are there any other conf files I should check?

In the apache2.conf file I found this,

Code:
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#

AccessFileName .htaccess
It was uncommented already so I left it alone. It says that I should see something called "Allowoverride Directive" but I don't know what that is.

Also, yes this is my home server.
__________________
Evga 680i SLI Mobo | C2d 6420 @ 3.2 | 2gb RAM | 9800gtx | Corsair 750w | Pioneer DVD Writer | 330gb | Antec 300
Ubuntu 9.04 | Windows 7

I miss my opty :c
Jk is offline   Reply With Quote
Old 02-19-2009, 07:21 AM   #4
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,007
Default Re: .htaccess doesn't work

Without wanting to sound like I'm giving up, I don't have a box that has Apache on it to test this at the moment, so the manual may be more help than I am!

but I believe that the allow override would be a selection that would allow specific clients to ignore the instructions in the .htaccess file.

so you could deny access to a folder to all clients, and allow override to yourself so that you can still see this.

or you may use .htacess to password protect a part of your site to allow members only access, but at the same time allow override to the google search bot so that your articles are still referenced to drive traffic towards the premium part of your site.
(e.g someone searches, finds a likely answer on your site and then may actually pay to access the part of your site where they know that the answer is).

you may need to look to be sure that your machine you're testing from isn't allowed to override.

again, reading the manual may also help.
you may find that you have conflicting statements in your .conf file.

so you may be setting directory permissions with .htaccess, but later saying to ignore .htaccess and allow all deny none
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline   Reply With Quote
Old 02-19-2009, 11:17 PM   #5
Jk
In Runtime
 
Jk's Avatar
 
Join Date: Jan 2006
Posts: 236
Default Re: .htaccess doesn't work

Ok, thanks for the replies. I'll check out the manual (totally slipped my mind), I'm sure I will learn a lot about setting up apache so that's good.

If anyone else has an idea let me know.
__________________
Evga 680i SLI Mobo | C2d 6420 @ 3.2 | 2gb RAM | 9800gtx | Corsair 750w | Pioneer DVD Writer | 330gb | Antec 300
Ubuntu 9.04 | Windows 7

I miss my opty :c
Jk is offline   Reply With Quote
Old 02-20-2009, 05:45 PM   #6
Site Team
 
David Lindon's Avatar
 
Join Date: Dec 2002
Posts: 15,233
Default Re: .htaccess doesn't work

You don't setup custom error pages with .htaccess, you use errordocument in the apache conf file: http://httpd.apache.org/docs/2.0/mod...#errordocument
__________________
[url=http://www.LNXPS.NET]LNXPS.NET - The XPS Library]
David Lindon is offline   Reply With Quote
Old 02-21-2009, 12:58 AM   #7
Jk
In Runtime
 
Jk's Avatar
 
Join Date: Jan 2006
Posts: 236
Default Re: .htaccess doesn't work

Thanks! Works great. I'm still going to read that manual though
__________________

__________________
Evga 680i SLI Mobo | C2d 6420 @ 3.2 | 2gb RAM | 9800gtx | Corsair 750w | Pioneer DVD Writer | 330gb | Antec 300
Ubuntu 9.04 | Windows 7

I miss my opty :c
Jk is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 04:36 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0