Installed WP in a subdir, can access wp-admin, but URLs are getting re-written without the subdir PATH. Where do I set this?
aclion at yepmail.net
aclion at yepmail.net
Mon Apr 30 20:35:08 UTC 2018
I've installed WP in a site subdir.
I can now access wp-admin pages at the expected URL.
Sort of. I can get there manually, but my site config keeps redirecting, stripping URLs of the subdir path to WordPress.
My config now has
wp-config.php
<?php
define('WP_HOME', 'https://test.example.com/blog');
define('WP_SITEURL','https://test.example.com/blog');
and for Nginx
location ^~ /blog {
root /srv/www/test/wp/public;
index index.php;
try_files $uri $uri/ /blog/index.php?$args;
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass phpfpm;
fastcgi_index index.php;
}
}
location / {
root /srv/www/test/public;
index index.php;
try_files $uri $uri/ /index.php?$args;
location ~ \.php {
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass phpfpm;
fastcgi_index index.php;
}
}
I visit
https://test.example.com/blog/wp-admin/plugins.php
It displays the correct page, the "Plugins" admin page. But the apparent URL (in the browser nav bar) is
https://test.example.com/
is missing the "/blog/wp-admin/plugins.php" part of the path.
AND links in the left nav bar are too.
For example, the link for 'Pages' shows on hover
https://test.example.com/edit.php?post_type=page
Click on it gives the expected
404 Not Found
But a MANUAL visit to
https://test.example.com/blog/wp-admin/edit.php?post_type=page
again gets me to the right page, with the URL displayed 'stripped' as
https://test.example.com/?post_type=page
I need to tell 'something' -- in WP or Nginx config I guess -- to use that path.
Question is: what?
AC
More information about the nginx
mailing list