HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Server Operation (http://www.howtoforge.com/forums/forumdisplay.php?f=5)
-   -   .htaccess (http://www.howtoforge.com/forums/showthread.php?t=13447)

Liac 16th June 2007 00:15

.htaccess
 
Hello all.

First of all, I hope this is the right forum. Like the title suggests, this thread is all about .htaccess and the headache it causes for me. :D

To put it simply: it doesn't work. I have spent almost 2 hours trying to figure out why, googled trying to find a solution, but to no avail.

Here's my simple .htaccess:
Code:

ErrorDocument 404 custom404.php
My server is running on a local machine. I'm using Ubuntu Linux Server 7.04 with auto-configured Apache, PHP and MySQL. I must say, this is my first try with Linux ever (!), so if you give a Linux-specific answer, I'd appreciate if you explain it for a newbie .

In /etc/apache2/ I have created a link in "mods-enabled" to rewrite.load in "mods-available". I hope that this has loaded the module (and it apparently has since loading it again with "LoadModule rewrite_module modules/mod_rewrite.so" in apache2.conf issues a warning, that it has already been loaded).

In my apache2.conf, there are also these lines:
Code:

AccessFileName .htaccess
(And at the end...):
Code:

<directory />
AllowOverride All
Options All
</directory>

When I specify the contents of the .htaccess file ("ErrorDocument 404 custom404.php") directly in apache2.conf, it works perfectly. So I guess I have configured something wrong, so that .htaccess files are just ignored.

So, how to make .htaccess files work?

Any help would be really appreciated :)

Thanks in advance,
Liac

bschultz 16th June 2007 01:03

Add this:

Code:

<Directory "/var/www/web1/web">
        Options FollowSymLinks
        AllowOverride All
</Directory>

To your Apache Directives field in the ISPConfig Control Panel. Of course, change the location of your website directories appropriately...mine are for Debian...not sure where Ubuntu puts it.

Liac 16th June 2007 02:32

Quote:

Originally Posted by bschultz
Add this:

Code:

<Directory "/var/www/web1/web">
        Options FollowSymLinks
        AllowOverride All
</Directory>

To your Apache Directives field in the ISPConfig Control Panel. Of course, change the location of your website directories appropriately...mine are for Debian...not sure where Ubuntu puts it.

Thank you for your reply! I just did that, still doesn't work... I have added
Code:

<Directory "/var/www/">
        Options FollowSymLinks
        AllowOverride All
</Directory>

/var/www/ is where I have my HTTP root. .htaccess files are still ignored.

bschultz 16th June 2007 03:04

I'm not positive, but I think you have to have the correct document root listed for the domain you are working on. So in the ISPConfig panel for the domain in question, put the correct directory path (including the web1, web2, etc.). If that doesn't work, there is a thread about this topic here:

http://www.howtoforge.com/forums/sho...ight=.htaccess

Liac 16th June 2007 03:50

Thanks again for your quick reply.

The point is, I don't have ISPconfig installed. I haven't even forwarded the HTTP port in my router settings, because I only access the server on my LAN. I want to use it as a "playground" to get familiar with Linux and develop my website, so that I can start right away when I'm renting a web server.

So the only document root I have is /var/www/. I have put there every file I need (php files, html files) and I can access them perfectly. Yet, .htaccess does not work.

I hope the problem gets clearer now :)

bschultz 16th June 2007 07:03

Place this (after the spot in your first post about apache2.conf):

Code:

<Directory "/var/www/">
        Options FollowSymLinks
        AllowOverride All
</Directory>

under this:

Code:

<directory />
AllowOverride All
Options All
</directory>


Liac 16th June 2007 17:15

Still doesn't work :(

I followed your link to the other thread. I commented

Code:

#<Files ~ "^\.ht">
#    Order allow,deny
#    Deny from all
#</Files>

out and added

Code:

<directory />
AllowOverride All
Options All
</directory>

<Directory "/var/www/">
        Options FollowSymLinks
        AllowOverride All
</Directory>

to my apache2.conf, restarted the server, but it still does not work. It's frustrating. I tried to play around with my settings, even re-installed the server, but to no avail.

Hopefully you or someone else still has an idea on what to do? :(

bschultz 16th June 2007 18:08

I'm reaching here....but what are the permissions (and ownership) of your .htaccess file?

Also, run this

Code:

httpd -t
as root from command line. That will check the syntax of the apache config file and tell us what (if any) errors there are.

Liac 16th June 2007 18:23

The permissions of the .htaccess file are 777 (read and write for owner, group and others) and the owner is a user I called "stduser". It's the only activated user (in Ubuntu, the root account is disabled by default. But you can still execute commands that require root access. If you are interested how this works, look here: https://help.ubuntu.com/community/RootSudo).

Code:

httpd -t
didn't work. It said "command not found". Instead I tried the following:
Code:

apache2 -t
and it said: "Syntax OK". I hope this helps. :confused:

bschultz 16th June 2007 18:30

Then I'm out of ideas...Falko, can you shed some light on this please?


All times are GMT +2. The time now is 11:02.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.