Subdomains & cgi-bin's

New to mod_rewrite? This is a good place to start.

Postby Guest » Sun Jun 23, 2002 10:20 am

I am currently having some problems seperating the cgi-bin from the rest of the sites content on a subdomain

I am currently using a modifered version of the 'Using a separate virtual host configuration file' example the rules i am using are below (these are all on one line in the config)

RewriteEngine on

RewriteMap lowercase int:tolower

# define the map file
RewriteMap vhost txt:/home/www/conf/vhost.map

# deal with aliases as above
RewriteCond %{REQUEST_URI} !^/icons/
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
# this does the file-based remap
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/$1

RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/$1

with vhost.map containing

http://www.domain.com /home/www/domain.com/
sub.domain.com /home/www/domain.com/public_html/sub

Predictable for cgi-bins on sub.domain.com it adds cgi-bin onto the above path however i would prefer if it went to /home/www/domain.com/cgi-bin/sub (or whatever the subdomain name might be) or is it wrong way to approach this sort of thing?

Finally is it possible to use User and Group with mod_rewrite or would another solution have to found for running cgi's securely?
Guest
 

Postby Guest » Sun Jun 23, 2002 10:25 am

Ignore the thing about (these are all on one line in the config) i wasn't sure weather the forum would break the rewrite rules/conds rules onto seperate lines or not but as it didn't the comment isn't needed anymore
Guest
 


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 18 guests

cron