Host two web application on the same domain using Apache

lmdz60z

It might be weird, but i need to setup a domain for two different applications, one is built with Symfony3 whereas the other has been made with Wordpress. Both websites are on the same server.

www.example.com -> wordpress

www.example.com/custom-slug -> symfony3

is it possible to achieve this using Apache2 ?

Thanks for your help

nidhi

You can use the Alias directive to map all requests matching the pattern /custom-slug/* to the Symfony app. All other URLs will be served from wordpress.

Sample vhost:

<VirtualHost *:80>
        ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /your_web_root/www_example_com/wordpress/

        # All URLs begining with /custom-slug will be fetched from the symfony app
        Alias "/custom-slug" "/your_web_root/www_example_com/symfonyApp/web/"

        <Directory /your_web_root/www_example_com/wordpress/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        <Directory /your_web_root/www_example_com/symfonyApp/web/>
                AllowOverride None
                Order Allow,Deny
                Allow from All

                <IfModule mod_rewrite.c>
                    Options -MultiViews
                    RewriteEngine On
                    RewriteCond %{REQUEST_FILENAME} !-f
                    RewriteRule ^(.*)$ app.php [QSA,L]
                </IfModule>
           </Directory>

</VirtualHost> 

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I host my API and web app on the same domain?

Use single domain to host web application and aws api gatwway?

What is the best approach to having a web site and web application with the same domain?

How to host multiple Github repos using the same custom domain on Netlify?

Apache configuration for Reactjs application and Symfony Api on the same domain

How to configure two different webapps to work with Apache on the same host/port?

How to Host Web API and MVC application on Same Address

Trouble running two web applications on the same domain on nginx

Using Apache to forward endpoints to different ports on the same host

Unable to access virtual host domain by name docker apache - a lamp stack application

Apache server session authentication using a web application

How to host my INDEX.php main page and CRUD Application separately on the same domain

Using two Google APIs with the same application

Using two logging framework in same Spring application

How to run two different apps on the same domain using heroku

Why is it not recommended to host receive endpoints in a web application using MassTransit?

Apache Virtual Host Mix IP and domain names

Apache virtual host without domain name

How to use same custom domain for Web app hosted on Azure and web application hosted on window's IIS server?

Using Vagrant, how can I access an apache virtual host from the host OS's web browser

Host 2 webapps under the same domain in Azure

How to route two different paths to the same server using apache

How to host a developed web application?

How can I have a wordpress page and a windows server web application under the same domain?

How to close two windows of the same application using python?

Create a scalable Application (Desktop, Web and Restful Api) using the same language

Symfony app and API on same Apache virtual host

Two way or send/reply SMS application using Tropo Web API

Apache VirtualHost with domain and subdomain, two different folders