You are not logged in.

#1 2009-03-26 08:27:11

shadowblue
Member
Registered: 2008-07-16
Posts: 10

htaccess not works at public_html: why?

Hi,
i have the topic problem.
The htaccess file works correctly in /srv/http dir, but if i use the same file in public_html it isn't see (i think).
I googled the question but i have not find a real answer to the problem.
Can someone help me?
Sorry for my english. tongue

PS: I have set "AllowOverride All" on: httpd.conf and the rispective config file for usersdir.

Offline

#2 2009-03-26 10:36:44

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: htaccess not works at public_html: why?

Hi!

Are you using apache2? Did you...

- Check "Set AllowOverride All" for the site the folder belongs to?
- a2dissite / a2ensite?

... or what software / setup are you using? Depending on your setup it might also be able, that the mod that does whatever you do with .htaccess is disabled for the folder (auth? Or modrewrite?)

Last edited by whoops (2009-03-26 10:38:44)

Offline

#3 2009-03-27 09:23:19

shadowblue
Member
Registered: 2008-07-16
Posts: 10

Re: htaccess not works at public_html: why?

Hi! Sorry for my delay.
I'm using Apache 2 (the last version on repository), and:
1) a2dissite / a2ensite aren't present (why?)
2) i have enable, manually, AllowOverride All in httpd.conf and httpd-userdir.conf but in http://localhost/~<username>/<site> the .htaccess not work.

Sorry but i not undestand where i fail. tongue
This is the /etc/httpd/conf/extra/httpd-userdir.conf

# Settings for user home directories
#
# Required module: mod_userdir

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.  Note that you must also set
# the default access control for these directories, as in the example below.
#
UserDir public_html

#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory "/home/*/public_html">
    #AllowOverride FileInfo AuthConfig Limit Indexes
    AllowOverride All
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

I have replace Allowoverride rule but not result.

Update: i have see that the .htaccess work for ErrorDocument directive but not for Rewrite Engine. smile Can it help?

Last edited by shadowblue (2009-03-27 09:27:15)

Offline

#4 2009-11-28 14:50:45

MindTooth
Member
From: Norway
Registered: 2008-11-11
Posts: 331

Re: htaccess not works at public_html: why?

Sorry to use your thread, but I experience the same problem. I can't get nothing to work with Apache. Neither .htaccess, custom 404 and mod_rewrite.

Isn't there anyone that might know what can cause this? As with shadowblue, I use vhost.

Offline

#5 2010-05-01 17:52:29

ciembor
Member
Registered: 2008-03-30
Posts: 57

Re: htaccess not works at public_html: why?

Same problem here:(.

Offline

#6 2011-06-01 06:09:59

Dijit
Member
Registered: 2011-06-01
Posts: 1
Website

Re: htaccess not works at public_html: why?

it's sad that this hasn't been updated. (I'm from google, if this has been resolved somewhere else, I'm sorry)

I seem to get some more output from:

<Directory /home/*/public_html>
    #AllowOverride FileInfo AuthConfig Limit
        AllowOverride None
        Options Indexes FollowSymLinks
        #Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

(where AllowOverride is None)

but it's almost the same as removing the .htaccess file itself. =/
(but at least I can see the directory right? xD)

EDIT:
I see my problem.
I defined AllowOverride twice, once in the .htaccess and once in the virtual hosts directive in apache.

I have a few 404's now, but the htaccess rewrites are working.

I suggest everyone checks where they define there allowed overrides.


EOL

Last edited by Dijit (2011-06-01 07:18:23)

Offline

#7 2011-11-15 19:31:36

camp
Member
From: Vancouver BC
Registered: 2009-01-20
Posts: 16

Re: htaccess not works at public_html: why?

Well I'm having the same problem. The configuration is exactly by the book of apache I think:

UserDir public_html
<Directory "/home/*/public_html">
    #AllowOverride FileInfo AuthConfig Limit Indexes
    AllowOverride All
    Options Indexes FollowSymLinks
    #Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

Even if I take a look in to .htaccess file what I have tried on sever several and distribution:

php_flag allow_url_fopen on

RewriteEngine on

# RewriteBase /home/*/public_html/site/

# RewriteCond %{HTTP_HOST} ^domain\.com [NC]
# RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ index.php?page=$1

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/([^/]+)?/?$ index.php?page=$1&page2=$2

And on last step, I look in to log file where I see that:

[Tue Nov 15 20:13:08 2011] [error] [client ::1] File does not exist: /srv/http/home, referer: http://localhost/*/site/

So now if I'm thinking right it's trying to find the directories in /srv/http/home, but I'm not requesting home I'm requesting different variable and why it's trying to find the directories in /srv/http if I'm using userdir. So I tried set RewriteBase in my htaccess file but same problem. To be honest I'm out of idea and I be happy when someone solve this.

Offline

#8 2011-12-20 22:20:52

JJ.Eastwood
Member
Registered: 2011-05-26
Posts: 17

Re: htaccess not works at public_html: why?

camp wrote:

And on last step, I look in to log file where I see that:

[Tue Nov 15 20:13:08 2011] [error] [client ::1] File does not exist: /srv/http/home, referer: http://localhost/*/site/

So now if I'm thinking right it's trying to find the directories in /srv/http/home, but I'm not requesting home I'm requesting different variable and why it's trying to find the directories in /srv/http if I'm using userdir. So I tried set RewriteBase in my htaccess file but same problem. To be honest I'm out of idea and I be happy when someone solve this.

I'm also having the same problem. My only solution is to change DocumentRoot in /etc/httpd/conf/httpd.conf from "/srv/http" to "/home/$user$/public_html" where $user$ is your username and restart apache.

EDIT:

This also lets you use Options +FollowSymLinks in your .htaccess

Last edited by JJ.Eastwood (2011-12-21 18:16:42)

Offline

#9 2011-12-23 05:15:32

Jasonvw
Member
From: Detroit, Michigan
Registered: 2011-12-23
Posts: 22

Re: htaccess not works at public_html: why?

First off, check to make sure mod_userdir is compiled or defined. It seems like the .htaccess files aren't coming into play yet because apache is not going to the right folder to read it in the first place.

httpd (or apache2ctl) --fullstatus

you should see a listing of modules in use there.


Also check your error_log.

if at some point you are getting 403s you may need to make sure you have permissions 755(folders) and 644(files)

If you have mod_userdir enabled, pastebin your apache configuration and post a line from the error log in case the error is different for any of you. Apache can be a real pain at times.


RAID !=backup

Offline

Board footer

Powered by FluxBB