Running WordPress in different directory
Table of Contents
MageStack allows you to run WordPress in a manner of different ways, if you simply want to run your blog from a directory called /blog
- see running WordPress in a subdirectory. But if you want to run a more complex WordPress deployment, where the URL differs from the directory structure itself, then the follow guide applies.
MageStack uses Nginx as the web server, so you just need to add the following rewrite rules to your respective domain's general rules.
Examples
Running a blog from /blog where the directory is /wp/wordpress
Edit ___general/example.com.conf
,
set $wordpress_dir '/wp/wordpress';
location ~* /blog(/|$) {
location ~* \.(php)$ {
rewrite ^/blog/(.*)$ $wordpress_dir/$1 break;
include fastcgi_params;
break;
}
rewrite ^/blog/(.*)$ $wordpress_dir/$1 break;
try_files $uri $uri/ $wordpress_dir/index.php;
break;
}
Adjust /blog/
to reflect the web URI and $wordpress_dir
to suit the path of your WordPress installation (relative to the document root)