Thursday, October 30, 2014

Virtualhost config for using wordpress and rails app on same server and under same domain

To host wordpress and rails app on same server you have to install wordpress in public folder of your rails app.

Below config are done by placing "/en/blog" and "/es/blog" in public folder of your rails app which are two wordpress setup in blog folder

      ServerName example.yourdomain.com
      # !!! Be sure to point DocumentRoot to 'public'!
   
      DocumentRoot /var/www/example/public
   
      #RailsEnv production    
   
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
   
   
   
         PassengerEnabled off
       
           RewriteEngine On
           RewriteBase /es/blog/
           RewriteCond %{REQUEST_FILENAME} !-f
           RewriteCond %{REQUEST_FILENAME} !-d
           RewriteRule . /es/blog/index.php [L]
       
   
     
   
         PassengerEnabled off
       
           RewriteEngine On
           RewriteBase /en/blog/
           RewriteCond %{REQUEST_FILENAME} !-f
           RewriteCond %{REQUEST_FILENAME} !-d
           RewriteRule . /en/blog/index.php [L]
       
using this you will be able to access your wordpress sites install in folder "/public/es/blog" and "/public/en/blog" by using below urls:-

example.yourdomain.com/en/blog
example.yourdomain.com/es/blog


Happy Coding:)

No comments:

Post a Comment