Hi all,
I have a dedicated server supplied by Fasthosts, that runs Fedora Core 3. Its an odd setup - the server runs Fasthosts’ “Matrix Control Panel”. Apache has a central config file (httpd.conf) and then the sites that are hosted on the server are listed in vhost.conf. The base settings are set in the httpd.conf I guess, and then overidden in vhost.conf, and then overidden some more in .htaccess.
I am having problems trying to get any mod_rewriting to work. As soon as I turn “RewriteEngine On”, I get a 500 internal server error. I look in the error log, and see “.htaccess: RewriteEngine not allowed here”. I guess there must be something wrong with my Apache setup - can anyone give me an idea as to what it might be?
I’ll copy in the important parts of each file below (with personal info omitted):
httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
Options FollowSymLinks
AllowOverride AuthConfig Indexes
</Directory>
<Directory "/var/www/html">
MultiViews
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
AccessFileName .htaccess
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
<Files ~ "^\\.ht">
Order allow,deny
Deny from all
</Files>
vhost.conf
Listen 80
ServerRoot "/etc/httpd"
<IfModule mod_dir.c>
DirectoryIndex default.html default.htm index.html index.htm index.shtml index.php index.php4$
</IfModule>
<VirtualHost [ip_address]:80 [ip_address]:80>
ServerName [domain_name]
ServerAlias [domain_name]
ServerAdmin webmaster@[domain_name]
DocumentRoot /home/default/[domain_name]/user/htdocs
ErrorLog /home/default/[domain_name]/user/logfiles/error_log
TransferLog /home/default/[domain_name]/user/logfiles/access_log
php_admin_value open_basedir /tmp:/home/default/[domain_name]
ErrorDocument 404 /errors/404.php
SuexecUserGroup [domain_name] matrixdomain
AddHandler server-parsed .shtml
AddType text/html .shtml
<Location />
#Options +Includes
#Options All
Options +FollowSymLinks
</Location>
# AC
<Directory /home/default/[domain_name]/user/htdocs/>
#AllowOverride AuthConfig Limit Indexes
AllowOverride All
Options +FollowSymLinks
</Directory>
# Begin user directives <--
# --> End user directives
.htaccess
RewriteEngine On
RewriteBase /
RewriteLog "/home/default/[domain_name]/user/htdocs/rewrite.log"
RewriteLogLevel 7
RewriteRule ^/portfolio/view/([0-9]*)/$ /portfolio/view.php?ID=$1
I am wanting to turn “/portfolio/view.php?id=3” into “/portfolio/view/4/”. However, even simple rules don’t work such as changing test.html into test.php (follow a tutorial here: http://www.datakoncepts.com/seo).
Anything glaringly obvious in my setup?
Matt