I know there are other similar to this thread, but I already tried for days and can not get this through, currently, with the below nginx configuration on Ubuntu 18
server { listen 80; root /var/www/html/wordpress/public_html; index index.php index.html; server_name "example.com"; access_log /var/log/nginx/SUBDOMAIN.access.log; error_log /var/log/nginx/SUBDOMAIN.error.log; location /blog { index index.php index.html index.htm; try_files $uri $uri/ /blog/index.php?q=$uri&$args; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.2-fpm.sock; } } location ~ /\.ht { deny all; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; }} Here is my folder current structure
- /var/www/html/wordpress/public_html -> include folder blog and one simple index.html (not serving wordpress)
- /var/www/html/wordpress/public_html/blog -> is my wordpress files location
However, there are two wrong parts I need to solve it.
- It display "mysite.com/blog" okay but when i click on any blog or url -> it shows " example.com/?p=1" and therefore leads the to simple index.html at location / (" example.com")
- I can not access to wp-admin also, it will redirect to this if i put "example.com/blog/wp-admin" -> "http://example.com/wp-login.php?redirect_to=http%3A%2F%2Fexample.com%2Fblog%2Fwp-admin%2F&reauth=1 -> then 404
Thank you so much.
Update 2: I tried changing the WP_SITEURL to example.com AND WP_HOME to example.com/blog also modified these 2 records in mysql wp-options table. however, when i tried access /blog/wp-admin -> http://example.com/blog/wp-admin/example.com/blog/wp-login.php?redirect_to=http%3A%2F%2Fexample.com%2Fblog%2Fwp-admin%2F&reauth=1 -> 404
WP_HOMEandWP_SITEURLWordPress configuration parameters; you can start reading from here./blog/index.php?q=$uri&$args;and not just a/blog/index.php?$args;? Can't this redirect come from the browser cache? Can you try from the incognito browser window?