I have built a website using WordPress. I installed WordPress on root domain i.e www.example.com . Now I want to install a Php Script based website on subdomain and subdirectories i.e subdomain.example.com and www.example.com/subdirectory. I know it is possible to do this but I need the working process to make it possible. If anyone know this then please guide me.

  • You need to do it using your webserver's configuration. What webserver are you using? Apache / Nginx?
    – Fayaz
    Commented Jan 28, 2017 at 10:33

1 Answer 1


Wordpress supports multi-sites setup for both sub-domain and subdirectory approach, please take a look at Create a Network.

  • I know about wordpress multisites but here I'm asking about Installing Php Script on subdomain and WordPress on root
    – freshvibes
    Commented Jan 28, 2017 at 7:15
  • So your so-called 'php scripted based' website means a non-wordpress site? In that case, you may need to create two VirtualHost directives on server level (Apache or Nginx, depend which one you are using), something like <VirtualHost *:80> DocumentRoot "/var/www/html/" </VirtualHost> for site1, and <VirtualHost *:80> DocumentRoot "/var/www/html/site2/" </VirtualHost> for site2
    – hcheung
    Commented Jan 28, 2017 at 7:32
  • Yes, it is non wordpress website. Are u telling me to create two separate directories in var/www/html folder? If yes then what to do after that?
    – freshvibes
    Commented Jan 28, 2017 at 10:38
  • You need to create two virtual host configurations at your server. Since the topic is not related to Wordpress, I don't want to post it here. But you could take a look at this link or search more on serverfault or check with your hosting company. Please noted that my example of /var/www/html/ is an example for typical apache server root directory, you need to check your actual hosting environment for your root directory.
    – hcheung
    Commented Jan 29, 2017 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.