I have a wordpress website served by nginx:
server {
listen 80;
server_name my_wordpress.example.com;
root /var/www/wordpress;
index index.php;
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param REQUEST_URI $request_url;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
}
}
What I want to do is to put one simple website consisting of only one file, let's say index.php
to temporarily take over the root url of my domain, while keeping the access to the wordpress website on another url.
What is the best way to achieve this?
I went into the direction of setting a variable when user access the url aiming to the wordpress website:
location /original-site {
set $request_url $request_uri;
set $original_site "true";
rewrite ^/original-site$ /; }
if ($original_site = "true") {
set $request_url /; }
redirecting the root url somewhere else:
if ($original_site != "true") {
rewrite ^/$ /new_website redirect; }
I'm using the $request_url
in php:
fastcgi_param REQUEST_URI $request_url;
I have not been very successful so far, I might find the bugs and finetune this approach, does there exist some more elegant way, how to do this?