Print

Activate Permalinks On Staging Site

When you create a new staging site, WP Staging default option is to disable search engine friendly custom permalinks on the staging site to ensure that staging sites are working properly on all server systems. Usually, this is okay for a staging website and you do not need to activate custom permalinks at all to benefit from using a staging site.

If you still like to activate permalinks on your staging site check out first what type of web server serves your website.

Apache Web Server

If your website is served by the Apache web server chances are good that search friendly permalinks are working without any additional work.

Just activate the permalinks from

wp-admin > Settings > Permalinks
 

Most often this is working very well from the beginning.

If this does not give the expected result and the links on the staging site are throwing an error 400, create a new .htaccess file and paste it into the root of the staging site by using a  FTP program

The content of that file should look like this:

# BEGIN WordPress

RewriteEngine On
RewriteBase /staging/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /staging/index.php [L]

# END WordPress

Replace the bold text staging with the sub folder name where the staging site has been copied to.

Nginx Web Server

If you are using the Nginx web server there is most often only an advanced way to activate permalinks on the staging site.  Before you follow that way, try to enable search friendly permalinks on the staging site as well.

wp-admin > Settings > Permalinks

Now check if this is working by opening the front page of your website and then open any link on it. This is either working or not. It is working if the link is opened in a new window. If it is not opening and returning a 404 error instead you need to follow the advanced way below.

To do so are you need to create a new server block in the nginx.conf which should be similar to the code below:

location /staging{
        try_files $uri $uri/ /staging/index.php?q=$request_uri;

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.1-fpm.sock;
        }

}

The path to the staging site must be adapted to your server as well as the path to the PHP socket file. This should give you only an idea what to change. Do not use these values word by word.

Be aware that you need full access to your server to follow the steps above. If you have no clue what these lines are doing it might be best to ask someone to assist you with the modifications or just keep the permalinks disabled.

After doing that, the Nginx server needs to be restarted and you can enjoy your staging site with enabled custom permalinks.