Forum Moderators: phranque
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?
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.
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.
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?