Apache VirtualDocumentRoot Host with MAMP (mod_rewrite)


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. # Mass Virtual Hosting (mod_rewrite method)
  2. <VirtualHost 127.0.0.1>
  3. ServerAlias *.dev
  4. RewriteEngine on
  5. RewriteCond %{HTTP_HOST} ^(.+).dev
  6. RewriteCond /Users/username/Sites/dev/%1/httpdocs -d
  7. RewriteRule ^(.*) /Users/username/Sites/dev/%1/httpdocs/$1 [L]
  8. <Directory /Users/username/Sites/dev/*/httpdocs>
  9. AllowOverride All
  10. </Directory>
  11. </VirtualHost>
  12. <VirtualHost *:80>
  13. ServerAlias *.somecustom.dyndns.org
  14. RewriteEngine on
  15. RewriteCond %{HTTP_HOST} ^(.+).somecustom.dyndns.org
  16. RewriteCond /Users/username/Sites/dev/%1/httpdocs -d
  17. RewriteRule ^(.*) /Users/username/Sites/dev/%1/httpdocs/$1 [L]
  18. <Directory /Users/username/Sites/dev/*/httpdocs>
  19. AllowOverride All
  20. </Directory>
  21. </VirtualHost>
  22.  

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.