0

I had some mod_rewrite rules in Apache 2.2 local dev server and they were working fine. Now After upgrading to Apache 2.4, I am trying to do a simple mod_rewrite rule and it is not working. It is however working with .htAccess. Is this a path problem? Or mod_rewrite is different in Apache 2.4? Any suggestions?

Local Dev Server info: WAMP-Server 2.5 - Windows 7 mod_rewrite is loaded and showing in php_info()

Apache config: http://apaste.info/OF3

<VirtualHost *:80>

ServerAdmin webmaster@site1.com
DocumentRoot "C:/wamp/www"
ServerName site1.example.com
ErrorLog "logs/site1-error.log"
CustomLog "logs/site1-access.log" common

<Directory "/site1">
Options +FollowSymLinks -MultiViews 
RewriteEngine On
RewriteBase /
LogLevel alert rewrite:trace3
RewriteRule ^/index.html$ /welcome.html
</Directory>

</VirtualHost> 
Yasser
  • 5
  • 4

1 Answers1

0

My guess is that the path you specify in <Directory "/site1"> is incorrect. You have DocumentRoot "C:/wamp/www", which means that the root of your website is in that directory. In order to apply rewrite rules using a <Directory>, you must specify the full path:

<Directory "C:/wamp/www">
    [...]
</Directory>

or maybe:

<Directory "C:/wamp/www/site1">
    [...]
</Directory>

Depending on what path you are actually trying to refer to using /site1.

olav
  • 376
  • 2
  • 4
  • I uninstalled my local server and reinstalled a new version. I don't know if this is the cause or not, but setting the full path as you mentioned is working now. Thanks – Yasser Jun 14 '15 at 15:55