mod_rewrite inside VirtualHost

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
tylerdurden
Forum Commoner
Posts: 66
Joined: Mon Jul 28, 2003 11:52 am
Location: Austria

mod_rewrite inside VirtualHost

Post 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
CyberSpatium
Forum Newbie
Posts: 21
Joined: Thu Mar 20, 2003 12:23 pm
Contact:

Post 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
tylerdurden
Forum Commoner
Posts: 66
Joined: Mon Jul 28, 2003 11:52 am
Location: Austria

Post by tylerdurden »

Thanks! But I have been doing this after each of my 100 (approx) tries with different syntax and settings ;-)
Post Reply