Skip to content

Instantly share code, notes, and snippets.

@vpnwall-services
Created October 29, 2019 17:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vpnwall-services/2bfa388e254bb1b335d4284afd88ac86 to your computer and use it in GitHub Desktop.
Save vpnwall-services/2bfa388e254bb1b335d4284afd88ac86 to your computer and use it in GitHub Desktop.
[URL to Wordpress Page] URL to Wordpress page #apache2 #ash #wordpress #redirection

ORIGINAL URL = www.mycompany.com

Create vhost for www.myproduct.com (pointing to ORIGINAL URL for folders (add CORS))

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName www.myproduct.com
        DocumentRoot /home/sites/www.mycompany.com/
        <Directory /home/sites/www.mycompany.com/>
                Options FollowSymLinks MultiViews
                AllowOverride All
        </Directory>
	<IfModule mod_headers.c>
		Header set Access-Control-Allow-Origin "*"
	</IfModule>
        ErrorLog /home/logs/apache2/www.mycompany.com-error.log
        CustomLog /home/logs/apache2/www.mycompany.com-access.log combined

        LogLevel        warn
</VirtualHost>

Modify www.company.com to add CORS (so new URL can pickup resources here)

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName www.mycompany.com
        DocumentRoot /home/sites/www.mycompany.com/
        <Directory /home/sites/www.mycompany.com/>
                Options FollowSymLinks MultiViews
                AllowOverride All
        </Directory>
	<IfModule mod_headers.c>
		Header set Access-Control-Allow-Origin "*"
	</IfModule>
        ErrorLog /home/logs/apache2/www.mycompany.com-error.log
        CustomLog /home/logs/apache2/www.mycompany.com-access.log combined

        LogLevel        warn
</VirtualHost>

Install this wordpress plugin Multiple Domain Mapping on single site https://fr.wordpress.org/plugins/multiple-domain-mapping-on-single-site/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment