Here's my goal : I have 9 websites running (names changed of course) :
- we.com
- we.fr
- doo.com
- doo.fr
- fpp.com
- ke.com
- wpp.com
- wgg.com
- t-y-u.fr
I wanted for each website :
- a directory to put a rotating log file. Done.
- update awstats for each on a 24 h basis and put the results in a separate directory :
- /web/awstats/we_com/ - /web/awstats/we_fr/ - /web/awstats/doo_com/ - /web/awstats/doo_fr/ - /web/awstats/fpp_com/ - /web/awstats/ke_com/ - /web/awstats/wpp_com/ - /web/awstats/wgg_com/ - /web/awstats/t_y_u_fr/
- make only one virtual host for a generic stats website and given a name, re-direct to the good statistics website. If you type one of those URLs the base path for the site should be changed accordingly :
1. http://stats.we.com/ change the base directory to /web/we_com 2. http://stats.we.fr/ change the base directory to /web/we_fr 3. http://stats.doo.com/ change the base directory to /web/doo_com 4. http://stats.doo.fr/ change the base directory to /web/doo_fr 5. http://stats.fpp.com/ change the base directory to /web/fpp_com 6. http://stats.ke.com/ change the base directory to /web/ke_com 7. http://stats.wpp.com/ change the base directory to /web/wpp_com 8. http://stats.wgg.com/ change the base directory to /web/wgg_com 9. http://stats.t-y-u.fr/ change the base directory to /web/t_y_u_fr
I've done it but it's sooooooo long : for each site here are the rules :
########################################### # site we.com RewriteCond %{HTTP_HOST} ^stats\.we\.com RewriteRule ^/$ /we/awstats.we.xml [QSA,L] # change other dirs to the base dir : RewriteCond %{HTTP_HOST} ^stats\.we\.com RewriteCond %{HTTP_HOST} ^stats\.we\.com RewriteRule ^/(.*) /wheeg/$1 [QSA,L]
if you have a good way of optimizing it i'd like to see it (remember there's one site with "-" and they have to be changed to "_") !