Find the answer to your Linux question:
Results 1 to 6 of 6
Hi to everyone. I got an Apache configuration problem that is sending me mad. I mean absolutly mad!!!!!!! Ok I've set up a test web server for some of the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie the bassinvader's Avatar
    Join Date
    Jun 2006
    Location
    Europe
    Posts
    168

    Angry apache, .htaccess, mod_rewrite, I hate you all


    Hi to everyone.

    I got an Apache configuration problem that is sending me mad. I mean absolutly mad!!!!!!!

    Ok I've set up a test web server for some of the guys at work and I'm struggling to get everything working. The problem being .htaccess and more
    specifically the ability to rewrite URL's using mod_rewrite. I used SuSE 10.3 which by default doesn't include the module necesary but I've
    seen to that and according to the php test page its loaded as a module so it should just be a case of enabling .htaccess in httpd.conf right??
    I know the .htaccess file is good because the website works fine online so its purely a config issue on our machine here.

    I've googled the problem to death and have now got to the point where I'm doubting my own name, never mind my configuration!!!

    Can anybody give me some advice on how to get this working, how to configure my httpd.conf file. Do I need to make entries in other config files?


    Here's the business end of my httpd.conf. At this point I doubt its correct.


    Code:
    # forbid access to the entire filesystem by default
    <Directory /> 
        Options 
        AllowOverride None
        Order deny,allow
        Deny from all
    </Directory>
    
    <Directory "/srv/www/htdocs">          
        AllowOverride all
        Order deny,allow 
    </Directory>
    
    # use .htaccess files for overriding,
    AccessFileName .htaccess
    # and never show them
    <Files ~ "^\.ht">
        Order allow,deny
        Deny from all
    </Files>

    When I look through the apache errors i get "script '/srv/www/htdocs/mysite/blahblahblah.php' not found or unable to stat"

    I'm close to insanity here so can anybody point me in the right direction
    " I didn't know it was a picture of his wife! I thought it was a publicity shot form Planet Of the Apes."

  2. #2
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,485
    Does your test site work without the .htaccess?

    What have you already tried?

    Can you post your .htaccess?
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    Conkybots: Interactive plugins for your Conkys!

  3. #3
    Linux Newbie the bassinvader's Avatar
    Join Date
    Jun 2006
    Location
    Europe
    Posts
    168
    Does your test site work without the .htaccess?
    If you mean does the page display in a browser then yes and other non-rewrite links work fine

    What have you already tried?
    Being a newcomer to apache my efforts have pretty much been on the conifg files looking for options I might need etc. Like I said I've googled extensively but only seem to come up with the same answears -AllowOveride all, and enabling the rewrite module. I'm 100% sure on both of these.

    Can you post your .htaccess?
    Yep


    Code:
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^mortgage_details_other_(.*).php$ mortgage_details_other.php?country=$1
    RewriteRule ^mortgages_country_(.*).php$ mortgages_country.php?country=$1
    " I didn't know it was a picture of his wife! I thought it was a publicity shot form Planet Of the Apes."

  4. #4
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,485
    I'm not really an expert in .htaccess myself. I tend to have varying success

    Try this...

    Code:
    Options +FollowSymLinks
     
    RewriteEngine On
    RewriteBase /
    
    RewriteRule mortgage_details_other_(.*).php$ mortgage_details_other.php?country=$1
    RewriteRule mortgages_country_(.*).php$ mortgages_country.php?country=$1
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    Conkybots: Interactive plugins for your Conkys!

  5. #5
    Linux Newbie the bassinvader's Avatar
    Join Date
    Jun 2006
    Location
    Europe
    Posts
    168
    Nope, no change

    Any other ideas?
    " I didn't know it was a picture of his wife! I thought it was a publicity shot form Planet Of the Apes."

  6. #6
    Linux Newbie the bassinvader's Avatar
    Join Date
    Jun 2006
    Location
    Europe
    Posts
    168
    Ok. This is one of those "this is how I solved my problem" replies.

    Like I suspected it wasn't very difficult, it just came down to something I didn't know which is specific to SuSE.

    To get mod_rewrite working all I had to do was to make a change in the default-server.conf, setting AllowOverwrite to All. I'd been tearing my hair out making changes to /etc/apache2/httpd.conf as I'd already made this change there too. I dont know if you need to make this change in both files or just in default-server.conf but rewriting now works on my system .............pheww
    " I didn't know it was a picture of his wife! I thought it was a publicity shot form Planet Of the Apes."

Posting Permissions

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