A trouble with .htaccess

Discussion in 'Installation/Configuration' started by jeanjacquesjeanjacques, Dec 7, 2006.

  1. Hi Guys,

    I don't understand why but i'm trying to create an .htaccess file with the following content:

    ptions -Indexes
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .+ ./index.php [L]

    All i get in return is an error 500.

    Do you have an idea of i'm doing wrong ?

    Any help would be really appreciated.

    Thanks
     
  2. jnsc

    jnsc rotaredoM Moderator

    Replace

    Code:
    ptions -Indexes
    with

    Code:
    Options -Indexes
    But you can also check you apache error logs
     
  3. Hi,

    Well sorry i've made a mistake when i copy/pasted, this is the real content of the .htaccess:

    Options -Indexes
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .+ ./index.php [L]

    I still get an error 500.

    I don't really understand because the error is not in the error.log.

    I tried cat /var/log/apache/error.log | grep mydomain.com

    Any suggestion ?
     
  4. jnsc

    jnsc rotaredoM Moderator

  5. Hi Jnsc,

    Thanks for the advice.
    I've changed my httpd.conf with this directive:

    #
    # This controls which options the .htaccess files in directories can
    # override. Can also be "All", or any combination of "Options", "FileInfo",
    # "AuthConfig", and "Limit"
    #
    AllowOverride all

    I restarted apache but i still get this error 400...

    i really don't understand.
     
  6. jnsc

    jnsc rotaredoM Moderator

    what is the output of
    Code:
    tail /var/log/apache/error.log
     
  7. Here it is:
    HTML:
    hulk:/home/www/web40/log# tail /var/log/apache/error.log
    [Thu Dec  7 22:01:32 2006] [notice] Accept mutex: sysvsem (Default: sysvsem)
    [Thu Dec  7 22:10:21 2006] [notice] SIGHUP received.  Attempting to restart
    [Thu Dec  7 22:10:21 2006] [notice] Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-16 configured -- resuming normal operations
    [Thu Dec  7 22:10:21 2006] [notice] Accept mutex: sysvsem (Default: sysvsem)
    [Thu Dec  7 22:14:51 2006] [notice] SIGHUP received.  Attempting to restart
    [Thu Dec  7 22:14:51 2006] [notice] Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-16 configured -- resuming normal operations
    [Thu Dec  7 22:14:51 2006] [notice] Accept mutex: sysvsem (Default: sysvsem)
    [Thu Dec  7 22:21:38 2006] [notice] SIGHUP received.  Attempting to restart
    [Thu Dec  7 22:21:38 2006] [notice] Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-16 configured -- resuming normal operations
    [Thu Dec  7 22:21:38 2006] [notice] Accept mutex: sysvsem (Default: sysvsem)
    hulk:/home/www/web40/log# 
    
     
  8. jnsc

    jnsc rotaredoM Moderator

    and
    Code:
    tail /home/www/web40/log/error.log
     
  9. Here is the output

    Code:
    hulk:~# tail /home/www/web40/log/error.log
    [Thu Dec  7 21:40:01 2006] [error] [client 88.160.48.159] File does not exist: /home/www/web40/web/golf-channel
    [Thu Dec  7 21:40:02 2006] [error] [client 88.160.48.159] File does not exist: /home/www/web40/web/favicon.ico
    [Thu Dec  7 21:40:05 2006] [error] [client 88.160.48.159] File does not exist: /home/www/web40/web/favicon.ico
    [Thu Dec  7 21:42:43 2006] [error] [client 88.160.48.159] File does not exist: /home/www/web40/web/favicon.ico
    [Thu Dec  7 21:42:44 2006] [error] [client 88.160.48.159] File does not exist: /home/www/web40/web/favicon.ico
    [Thu Dec  7 21:42:50 2006] [error] [client 88.160.48.159] File does not exist: /home/www/web40/web/favicon.ico
    [Thu Dec  7 21:54:53 2006] [error] [client 88.160.48.159] File does not exist: /home/www/web40/web/favicon.ico
    [Thu Dec  7 21:54:55 2006] [error] [client 88.160.48.159] File does not exist: /home/www/web40/web/golf-cart
    [Thu Dec  7 21:57:51 2006] [error] [client 88.160.48.159] File does not exist: /home/www/web40/web/golf-equipment
    [Thu Dec  7 22:00:24 2006] [error] [client 88.160.48.159] File does not exist: /home/www/web40/web/golf-play
    
    I don't understand i can't see the error 400 in there
     
  10. jnsc

    jnsc rotaredoM Moderator

    Is it now an error 400 or still 500, because it's a different one
     
  11. Hello,
    I feel a little bit stuck, is there someone who encountered this kind of error ?

    best regards,
     
  12. falko

    falko Super Moderator Howtoforge Staff

  13. Hello Falko,

    Now i get this error message
    Code:
    Bad Request
    Your browser sent a request that this server could not understand.
    
    Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/1.3.33 Server at www.mydomain.com Port 80
    
    And here is the content of the apache directives for this website:
    Code:
    
    Options -Indexes
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .+ ./index.php [L]
    
    
     
  14. Hi,
    I've tried something else, instead of inserting the content of the .htaccess file thanks to the web interface inside the apache directives section i've created the file .htaccess.
    The file .htaccess has been uploaded to the root directory but now i get this error:
    Code:
    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    
    Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
    
    More information about this error may be available in the server error log.
    
    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. 
     
  15. falko

    falko Super Moderator Howtoforge Staff

    Anything in Apache's error log?

    Can you try
    Code:
    <IfModule mod_rewrite.c>
     RewriteEngine on
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
    </IfModule>
    in your .htaccess file?
     
  16. Hello,

    It works now :)
    I've deleted everything inside the apache directives section. I created a .htaccess file that i uploaded inside the root folder of the website.
    Now it works fine,
    Thanks for your help guys.
     

Share This Page