Results 1 to 11 of 11
  1. #1

    need help, confused about .htaccess behaviour

    I am needing to do a simple redirect from my new apache server.

    When I hit the domain at root level I get the standard redirection to the apache2-default/

    What I want is for anyone hitting the domain to get redirected to the portal page which is at /var/www/mxBB/index.php

    I understand that an .htaccess file with:

    should redirect the entire root level www directory to the /mxBB directory and therefore pick up index.php which is what happens if you enter the mxBB directory directly.

    I have tried

    redirect /var/www/

    redirect /index.html
    but to no avail.

    What am I doing wrong? i must be missing something critical - is the .htaccess file not even getting read? Is there something overriding it? The .htaccess file is:



  2. #2
    Join Date
    Jul 2001
    Almost right. I think what you may be looking for is this:

    redirect 301 /
    "Obsolesence is just a lack of imagination."

  3. #3
    Thanks for the advice, unfortunately it still doesn't work. Is it possible that .htaccess is not getting read somehow?

    Is this an apache config issue?

    when I have .htaccess as you describe in /var/www/.htaccess
    and hit or

    i don't get any different behaviour.

  4. #4
    No .htaccess files are having any effect in any of the directories of my server. All other web behaviour is normal !!!

    Is there some config that causes apache to ignore .htaccess??

    Please can someone help me here please

  5. #5
    Join Date
    Jun 2005
    You could try this...

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)mxBB/$1 [QSA]

    You will need to test it carefully

  6. #6
    Join Date
    Jun 2004
    Northwest Colorado
    Originally posted by stardotstar
    Is there some config that causes apache to ignore .htaccess??
    Yes, it's possible that the server administrator hasn't enabled .htaccess, if you have access to the 'httpd.conf' file, look for a section similar to this:

    # 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
    Eric J. Bowman, principal
    Bison Systems Corporation coming soon: a new sig!
    I'm just a poor, unfrozen caveman Webmaster. Your new 'standards' frighten, and confuse me...

  7. #7
    Thank You BigBison,

    I have parsed my httpd.conf file and found only this section when searching for .htaccess

    DirectoryIndex index.html index.cgi index.php index.xhtml
    # UserDir is now a module
    #UserDir public_html
    #UserDir disabled root
    #<Directory /home/*/public_html>
    #	AllowOverride FileInfo AuthConfig Limit
    #	Options Indexes SymLinksIfOwnerMatch IncludesNoExec
    AccessFileName .htaccess
    <Files ~ "^\.ht">
        Order allow,deny
        Deny from all
    UseCanonicalName Off
    TypesConfig /etc/mime.types
    DefaultType text/plain
    I am the server admin - I have set up a plain Debian server from scratch and got most working but out of my depth here...

    Kamate - I don't understand your suggestion at all - where does this instructions go?

    Will *.*(Thanks for the help - guys I am still at a loss)

  8. #8
    Join Date
    Jul 2001
    #<Directory /home/*/public_html>
    # AllowOverride FileInfo AuthConfig Limit
    # Options Indexes SymLinksIfOwnerMatch IncludesNoExec
    The above is the relevant section. It is currently commented out. You need to remove the comments to permit AllowOverride to work and then restart Apache. I advise reading the apache docs carefully.
    "Obsolesence is just a lack of imagination."

  9. #9
    Thank you NyteOwl, that is invaluable and yes I am reading the manuals - just a little swamped with the scale of the information.

  10. #10
    This section was actually in the apache2.conf file... I understand that httpd.conf is still supported but I know that uncommenting the section in apache2.conf is the correct config file because I changed the:
    DirectoryIndex index.html index.cgi portal.php index.php index.xhtml
    to make my deafult home page in this directory portal.php rather than index.php and this is working...

    Having uncommented the section mentioned though the .htaccess files are still having no effect - this is the .htaccess I have in the server root - which still redirects to apache2-default automatically (ignoring the .htaccess as far as I can tell):

    [email protected]:/etc/init.d$ cat /var/www/.htaccess
    RedirectMatch 301 /
    Further guidance appreciated - reading manual and searching web in the mean time :-)


  11. #11
    OK, I have sorted it all out =- thanks for the pointers - I had to delve into the virtual server conf files and set the RedirectMatch...

    Things have been sorted out in the actual conf now rather than using .htaccess to reduce server load.

    Thanks for all the help.

    Will.* :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts