Using Mod Rewrite without .htaccess
Posted by: Maudib (---.6197.cust.vallnet.com)
Date: December 17, 2006 10:38PM

I am working with mod rewrite and virtualhosts.

I'd like to be able to use the rewrite directives without putting .htaccess files out since the rules are specific to each virtual host.

I know the rules I am using are working - because if I put them in an .htaccess folder they perform as expected.

However if I put them in the httpd.conf file they seem to have no effect.

I have a feeling that it is a permissions thing that is causing the directives to be ignored, but am new at using them so I am a bit unsure where to look.


I have this entry:

<VirtualHost *>
ServerName local.mytest.com
DocumentRoot "C:\wamp\www\mytest"
RewriteEngine On
RewriteRule ^testmod.html /testme.php?URL=testmod.html [R,NC,L]
ErrorLog logs/local.mytest.com-error_log
</VirtualHost>


Also a question about "where" to put the directives (when NOT using the .htaccess)

Can these go in the VirtualHost entry or do they have to go into a <Directory> entry like this:

<Directory "C:/wamp/www/mytest">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
RewriteEngine on
RewriteRule ^testmod.html /testme.php?URL=testmod.html [R,NC,L]
</Directory>


Since no physical files are served from this server (everything is being forwardt via ProxyPass and ProxyPassReverse to a secondary application server) it seemed logical to put the rewrite statements in the VirtualHost entry.

Thanks!

Options: ReplyQuote


Sorry, only registered users may post in this forum.