Welcome to WebmasterWorld Guest from 34.201.121.213

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

RewriteRule in http.conf

SymLinksIfOwnerMatch is off implies RewriteRule directive is forbidden

     
8:57 am on Dec 3, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 12, 2003
posts:51
votes: 0


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/www/rpgdomains/html
ServerName mysite.com
Options SymLinksIfOwnerMatch
<Directory "/home/donboy/www/rpgdomains/html">
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/www/rpgnet/html
ServerName my_other_site.com
Options +FollowSymLinks +Includes -Indexes
<Directory "/home/donboy/www/rpgnet/html">
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: "Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden" 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 "test page" 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?

9:09 am on Dec 3, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Oct 6, 2003
posts:264
votes: 0


Hi, I'm also just into this stuff & testing it locally. Was successful in certain ways.
But your problem seems to be the module, I think the modrewrite module is not on.
Check to see if both is set uncommented #
LoadModule rewrite_module modules/mod_rewrite.so
&
AddModule mod_rewrite.c

And in your main conf file you have turned on,so that you dont have to specify it in the virtual host comment.
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
&
<Directory "/var/www/html">
Options FollowSymLinks MultiViews Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>

Hope that helps.
While your rewriterules, maybe someone else might spot the errors if there's any.

9:30 am on Dec 3, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 12, 2003
posts:51
votes: 0


I am running apache 2.0.40 and when I tried adding the AddModule mod_rewrite.c, it threw an error saying that I was trying to use an apache v1 directive. Maybe I don't need the AddModule stuff in v2 (I guess).

I also have the module loading as it should be. I have a whole slew of modules being loaded including mod_rewrite.

LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so

And I also wonder if it's a good idea to declare stuff at the higher levels. If I do, then those directives may apply to other vhosts elsewhere in the conf file where I don't want them to apply.

9:36 am on Dec 3, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Oct 6, 2003
posts:264
votes: 0


Havent tried or read version 2, can't help there then.
But in version 1.3 both should be uncommented to have them work beautifully. :)

Yes, your option on wanting only certain host specific to run the symlinks than should follow as you;ve suggested.

Maybe you don't need to put in the + sign, just a space will do?