snipe7kills Posted March 19, 2008 Share Posted March 19, 2008 Hello all! i know very little perl and am hoping someone here could help me make this work. what i would like to do is store all the information in a mysql database so i can quickly edit and add this information without having to open a shh connection to the server. i also would like to include wildcards due to the fact i have several domains and a few things should be accessible on any domain. an example of this would be mail.* needs to go to /var/mail but i would also like to be able to have *.sub0.domain.org go to /var/www/forum or even *.domain2.org go to /var/www/crazy while *.sub1.domain2.org goes to /var/www/crazy/dynamic_content Any help would be great please feel free to contact me sniper7kills<at>gmail.com or AIM: sniper7kills thank you in advance Quote Link to comment Share on other sites More sharing options...
snipe7kills Posted March 19, 2008 Author Share Posted March 19, 2008 or even if someone could help me create a script that would get the information from the database and not use wildcards it would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
snipe7kills Posted March 23, 2008 Author Share Posted March 23, 2008 ok so this is what i have so far vhosts.pl $|=1; use Mysql; $db = Mysql->connect(localhost, apache, USER, PASSWORD); $db->selectdb(apache); $sql_query="SELECT * FROM rewritemaps"; $query = $db->query($sql_query); while(%hash = $query->fetchhash){ print($hash{'name'}." ".$hash{'location'}); } and its being called like this: RewriteEngine on RewriteMap lowercase int:tolower RewriteMap vhost prg:/etc/httpd/conf.d/vhosts.pl RewriteCond %{REQUEST_URI} !^/icons/ RewriteCond %{REQUEST_URI} !^/cgi-bin/ RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$ RewriteCond ${vhost:%1} ^(/.*)$ RewriteRule ^/(.*)$ %1/$1 RewriteCond %{REQUEST_URI} ^/cgi-bin/ RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$ RewriteCond ${vhost:%1} ^(/.*)$ RewriteRule ^/(.*)$ %1/cgi-bin/$1 [T=application/x-httpd-cgi] the mysql database is arranged like this: Name Location www.domain.com /var/www/html/some_folder But its not working Anyone have any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.