最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Nginx redirects to an extra subdirectory

programmeradmin1浏览0评论

I have a local site installed with VVV that I've installed in a subdirectory to try and mimic the production environment.

/m/

Pages are working as expected

/m/some-page/

But requests to wp-admin redirect to a URL with an extra directory in the path

/m/wp-admin -> /m/m/wp-admin/

My localtest.conf is as follows:

server {
# Determines the port number that nginx will listen to for this
# server configuration. 80 is the default http port.
listen       80;

# Listen for HTTPS requests as well
listen       443 ssl;

# Tells nginx what domain name should trigger this configuration. If
# you would like multiple domains or subdomains, they can be space
# delimited here. See .html
server_name  localtest.dev ~^localtest\.\d+\.\d+\.\d+\.\d+\.xip\.io$;

# Tells nginx which directory the files for this domain are located
root         /srv/www/localtest/htdocs;
index       index.php;
# Subdirectory location settings

location /m/ {
    try_files $uri $uri/ /m/index.php?$args;
}

# Includes a basic WordPress configuration to help with the common
# rules needed by a web server to deal with WordPress properly.
include /etc/nginx/nginx-wp-common.conf;
}

Any advice would be greatly appreciated.

I have a local site installed with VVV that I've installed in a subdirectory to try and mimic the production environment.

http://localtest.dev/m/

Pages are working as expected

http://localtest.dev/m/some-page/

But requests to wp-admin redirect to a URL with an extra directory in the path

http://localtest.dev/m/wp-admin -> http://localtest.dev/m/m/wp-admin/

My localtest.conf is as follows:

server {
# Determines the port number that nginx will listen to for this
# server configuration. 80 is the default http port.
listen       80;

# Listen for HTTPS requests as well
listen       443 ssl;

# Tells nginx what domain name should trigger this configuration. If
# you would like multiple domains or subdomains, they can be space
# delimited here. See http://nginx/en/docs/http/server_names.html
server_name  localtest.dev ~^localtest\.\d+\.\d+\.\d+\.\d+\.xip\.io$;

# Tells nginx which directory the files for this domain are located
root         /srv/www/localtest/htdocs;
index       index.php;
# Subdirectory location settings

location /m/ {
    try_files $uri $uri/ /m/index.php?$args;
}

# Includes a basic WordPress configuration to help with the common
# rules needed by a web server to deal with WordPress properly.
include /etc/nginx/nginx-wp-common.conf;
}

Any advice would be greatly appreciated.

Share Improve this question asked Oct 9, 2015 at 20:16 ColinColin 1212 gold badges3 silver badges8 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Remove '/m' from '/m/index.php?$args;'

发布评论

评论列表(0)

  1. 暂无评论