How to Install WordPress Manually on Windows Free with in 5 min | Yess See

server { location / { try_files $uri $uri/ @extensionless-php; } location /shop { try_files $uri $uri/ /shop/index.php?q=$uri&$args /shop/index.php?q=$uri&$args; } location ~ \.php$ { if ($request_uri ~ (.*)\.php$) { return 301 $1; } try_files $uri =404; include /etc/nginx/fastcgi.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; } location @extensionless-php { rewrite ^(.*)$ $1.php last; } 

The above code is used in nginx server file. I have wordpress installed in a subdirectory. When I try to login into my dashboad using username and password through wp-login.php page it redirects to 404 not found. The other pages of the wordpress blog works fine. I cannot access my dashboard only. Please help me to solve the issue. Thanks in advance.

You may want to add a separate (nested) location ~ \.php$ block for WordPress to isolate it from the extension-less PHP rules used for the rest of your site.

For example:

location / { ... } location ^~ /shop { try_files $uri $uri/ /shop/index.php?q=$uri&$args; location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi.conf; fastcgi_pass unix:/run/php/php7.0-fpm.sock; } } location ~ \.php$ { ... } location @extensionless-php { ... } 

The ^~ modifier gives the prefix location higher precedence than the regular expression locations at the same level. See this document for details.

  • 3 @Pal If this answered your question then please consider marking it as 'accepted' (checkmark on the left below the voting arrows) to give credit and help other users. You can also 'upvote' answers you find useful. Thanks, much appreciated. :)

arbejdet for dig: Charles Robertson | Ønsker du at kontakte os?