Forum Moderators: phranque

Message Too Old, No Replies

Apache ignoring .htaccess

         

FiRe

10:30 am on Dec 16, 2008 (gmt 0)

10+ Year Member



I have a .htaccess file in the root directory which works fine for me but when uploaded onto a Linux box with Apache it does not work.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^(.*).html index.php?page=$1 [QSA]
RewriteRule ^sitemap.xml google-sitemap.php

If I go to Home.html for example it should load index.php?page=Home but instead it says page not found, and same if I go to sitemap.xml

I have done a phpinfo() on the server and in the apache2handler section under Loaded Modules it says mod_rewrite so I dont see why else this shouldnt work. Any ideas?

Samizdata

1:53 pm on Dec 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Some server configurations require Symlinks specifically enabled:

# Set options
Options +FollowSymlinks

# Turn on mod_rewrite
RewriteEngine On

Might do the trick.

...

Caterham

6:12 pm on Dec 16, 2008 (gmt 0)

10+ Year Member



but when uploaded onto a Linux box with Apache it does not work.
It looks like AllowOvrride FileInfo was not set, so your directives in per-directory configuration files are simply ignored.

Some server configurations require Symlinks specifically enabled:
If RewriteRules are used in per-dir context and the option Followsymlinks is not enabled for that directory, you'd receive a 403 forbidden error issued by mod_rewrite.

jdMorgan

7:20 pm on Dec 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Minor tweak:

If RewriteRules are used in per-directory context and the Option FollowSymLinks or SymLinksIfOwnerMatch is not enabled for that directory, you'd receive a 403 Forbidden error issued by mod_rewrite.

Jim