Difference between revisions of "Apache"
From Leaky
(Created page with " == IP based redirect == Apache virtualhost config to allow configuring of a Wordpress site while still redirecting the domain to some other site until Wordpress is ready. S...") |
(→IP based redirect) |
||
Line 7: | Line 7: | ||
ServerAdmin webmaster@example.com | ServerAdmin webmaster@example.com | ||
DocumentRoot /home/example/public_html/ | DocumentRoot /home/example/public_html/ | ||
− | + | ||
RewriteEngine On | RewriteEngine On | ||
# Replace 1.2.3.4 with the IP setting up the site | # Replace 1.2.3.4 with the IP setting up the site | ||
RewriteCond %{REMOTE_ADDR} =1.2.3.4 | RewriteCond %{REMOTE_ADDR} =1.2.3.4 | ||
RewriteRule ".?" "-" [L] | RewriteRule ".?" "-" [L] | ||
− | + | ||
# Everyone other than 1.2.3.4 gets redirected to example.wordpress.com | # Everyone other than 1.2.3.4 gets redirected to example.wordpress.com | ||
RewriteCond %{SERVER_NAME} =example.com [OR] | RewriteCond %{SERVER_NAME} =example.com [OR] | ||
RewriteCond %{SERVER_NAME} =www.example.com | RewriteCond %{SERVER_NAME} =www.example.com | ||
RewriteRule ^ https://example.wordpress.com%{REQUEST_URI} [NE,R=temp,L] | RewriteRule ^ https://example.wordpress.com%{REQUEST_URI} [NE,R=temp,L] |
Latest revision as of 21:56, 17 June 2023
IP based redirect
Apache virtualhost config to allow configuring of a Wordpress site while still redirecting the domain to some other site until Wordpress is ready.
ServerName www.example.com ServerAlias example.com ServerAdmin webmaster@example.com DocumentRoot /home/example/public_html/ RewriteEngine On # Replace 1.2.3.4 with the IP setting up the site RewriteCond %{REMOTE_ADDR} =1.2.3.4 RewriteRule ".?" "-" [L] # Everyone other than 1.2.3.4 gets redirected to example.wordpress.com RewriteCond %{SERVER_NAME} =example.com [OR] RewriteCond %{SERVER_NAME} =www.example.com RewriteRule ^ https://example.wordpress.com%{REQUEST_URI} [NE,R=temp,L]