Skip to content

Instantly share code, notes, and snippets.

@rilwis

rilwis/vhost.bat Secret

Last active November 26, 2016 02:30
Show Gist options
  • Save rilwis/6b3ae9528665dabdbb4eef38b1d303f2 to your computer and use it in GitHub Desktop.
Save rilwis/6b3ae9528665dabdbb4eef38b1d303f2 to your computer and use it in GitHub Desktop.
Vhost
@echo OFF
SET ApacheConf=C:\xampp\apache\conf\extra\httpd-vhosts.conf
SET InstallPath=D:\Sites\%1.dev
SET MysqlUsername=root
SET MysqlPassword=
SET SiteTitle=%1
SET AdminUsername=admin
SET AdminPassword=admin
SET AdminEmail=admin@%1.dev
echo.127.0.0.1 %1.dev>> %SYSTEMROOT%\System32\drivers\etc\hosts
echo.^<VirtualHost *:80^>>> %ApacheConf%
echo. DocumentRoot "%InstallPath%">> %ApacheConf%
echo. ServerName %1.dev>> %ApacheConf%
echo.^</VirtualHost^>>> %ApacheConf%
mysqladmin -u %MysqlUsername% --password="%MysqlPassword%" create %1
if not exist "%InstallPath%" mkdir %InstallPath%
cd /d %InstallPath%
wp core download && wp core config --dbname=%1 --dbuser=%MysqlUsername% --dbpass=%MysqlPassword% && wp core install --url=%1.dev --title=%SiteTitle% --admin_user=%AdminUsername% --admin_password=%AdminPassword% --admin_email=%AdminEmail%
echo Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment