Page 1 of 1

mod_rewrite inside VirtualHost

Posted: Sun Jan 23, 2005 5:43 am
by tylerdurden
Hi!

I have a question regarding mod_rewrite inside a VirtualHost directive in the httpd.conf

The rewrite action I'm using is pretty simple and works without problem when I put it into a .htaccess file. However, I can't get it to work when I try to put it into the VirtualHost section inside httpd.conf:

Code: Select all

<VirtualHost 213.162.134.167:80>
ServerName mydomain.com   
RewriteEngine on
RewriteRule ^(&#1111;a-zA-Z0-9_'"]*)\.html$       index.php?page=$1
DocumentRoot /home/www/mydomain/html
</VirtualHost>
This simply rewrites any html file to a php file, e.g. index.html becomes index.php?page=index

Is there anything I need to change in the httpd.conf for this to work?

Thanks!

tylerd

Posted: Sun Jan 23, 2005 11:46 pm
by CyberSpatium
anytime you modify httpd.conf, you have to restart apache to let the new settings take effect.

How to restart apache with linux:

if you have apache 1, use this command:

Code: Select all

apachectl restart
if you have apache2 use this command:

Code: Select all

apache2ctl restart
on my windows system, this command works for me, however depending on your setup if maybe different. Or you can use the ApacheMonitor to restart the server.

Code: Select all

Start Button -> Run -> apache restart
if you can not get apache to restart, just reboot your computer.

CyberSpatium

Posted: Mon Jan 24, 2005 3:12 am
by tylerdurden
Thanks! But I have been doing this after each of my 100 (approx) tries with different syntax and settings ;-)