Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RewriteRule in http.conf

Status
Not open for further replies.

Donboy

IS-IT--Management
Aug 20, 2002
73
US
Since it's more efficient to have everything in the http.conf instead of having it in .htaccess files, I want to add some RerwiteRules to one of my virtual hosts.

I have tried adding it under the <VirtualHost> block, but everytime I do this, it's pretty much ignored, even though the documentation says its possible to use it in this context. Weird.

However, I have been able to make it work successfully with one of my vhosts by putting it within a directory container like this...

<VirtualHost 192.168.0.50>
ServerAdmin me@you.com
DocumentRoot /home/donboy/ServerName mysite.com
Options SymLinksIfOwnerMatch
<Directory &quot;/home/donboy/Options ExecCGI SymLinksIfOwnerMatch
AllowOverride All
Order allow,deny
Allow from all
ErrorDocument 401 /default.pl?&x=401
ErrorDocument 403 /default.pl?&x=403
ErrorDocument 404 /default.pl?&x=404
ErrorDocument 500 /default.pl?&x=500
RewriteEngine on
RewriteRule ^this1 /cgi-bin/that1.cgi [R=301,L]
RewriteRule ^this2 /cgi-bin/that2.cgi [R=301,L]
</Directory>
</VirtualHost>

However, when I try to use these same rules in a another vhost, it fails. Here is what the other vhost looks like...

<VirtualHost 192.168.0.50>
ServerAdmin me@you.com
DocumentRoot /home/donboy/ServerName my_other_site.com
Options +FollowSymLinks +Includes -Indexes
<Directory &quot;/home/donboy/Options +ExecCGI +FollowSymLinks +Includes -Indexes
AllowOverride All
Order allow,deny
Allow from all
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
RewriteEngine on
RewriteRule ^this1 /cgi-bin/that1.cgi [R=301,L]
RewriteRule ^this2 /cgi-bin/that2.cgi [R=301,L]
</Directory>
</VirtualHost>

When I try this, I get the following error in my logs: &quot;Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden&quot; and I get redirected to my 403 error page.

I have tried using both FollowSymLinks and SymLinksIfOwnerMatch under the vhost itself and also under the directory block too, but it didn't matter. I also added all the plusses to my options just to be more explicit (thinking that would help) but it didn't matter either.

I also tried moving the Rewrite rules above the error pages, but that made the whole thing fail. In that case, I got the old &quot;test page&quot; that you normally see when setting up apache for the first time.

I also tried using the Rewrite rules in a regular htaccess file but that didn't work either. I get the same error in my logs and the 403 page.

Any idea what I'm doing wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top