I have a few domains (e.g. vssp-wp.de, vssp-wp-berlin.de, vssp-wp-bayern.de, ...).
I would like to redirect these to the global Wordpress instance at vssp-wp.de. In the background they are redirected to vssp-wp.de/berlin and vssp-wo.de/bayern.
But I want vssp-wp-berlin.de to be displayed in the URL field in the browser and not vssp-wp.de/berlin. Same example for bayern.
If I am correct, the solution is to use the proxy flag in the .htaccess file.
Unfortunately, several attempts (one attached) did not lead to success.
RewriteEngine On
RewriteRule ^/?berlin/(.*)$ /$1 [L,P]
RewriteRule ^/?bayern/(.*)$ /$1 [L,P]
ProxyPassReverse / /
Additional informations:
I have a few domains (e.g. vssp-wp.de, vssp-wp-berlin.de, vssp-wp-bayern.de, ...).
I would like to redirect these to the global Wordpress instance at vssp-wp.de. In the background they are redirected to vssp-wp.de/berlin and vssp-wo.de/bayern.
But I want vssp-wp-berlin.de to be displayed in the URL field in the browser and not vssp-wp.de/berlin. Same example for bayern.
If I am correct, the solution is to use the proxy flag in the .htaccess file.
Unfortunately, several attempts (one attached) did not lead to success.
RewriteEngine On
RewriteRule ^/?berlin/(.*)$ http://vssp-wp.de/berlin/$1 [L,P]
RewriteRule ^/?bayern/(.*)$ http://vssp-wp.de/bayern/$1 [L,P]
ProxyPassReverse / http://vssp-wp.de/
Additional informations:
No need for a proxy here, as far as I can see. A ServerAlias should be enough:
The virtual host definition:
<VirtualHost *:443>
ServerName vssp-wp.de
ServerAlias vssp-wp-berlin.de
ServerAlias vssp-wp-bayern.de
DocumentRoot "/some/path"
# Other directives here
</VirtualHost>
The rewriting rule:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^(?:www\.)?vssp-wp\.de$
RewriteCond %{HTTP_HOST} ^(?:www\.)?vssp-wp-(\w+)\.de$
RewriteRule ^ /%1%{REQUEST_URI} [L]
The file system layout:
/some/path/
berlin/
bayern/
That is a simple internal redirection, leaving the visible URL alone. The basic idea behind this: you use one single virtual host that responds to requests to all those domains. Based on what http host has been requested (the domain), requests are internally rewritten to their matching directory.
