• Resolved Philip

    (@philipwalter)


    Okay, so I have wordpress up and running on the latest version of Nginx. I did some research and configured the server to handle rewrites, but something is up. I also found a plugin to tell WordPress not to put the index.php in the permalink, like https://example.com/index.php/rest/of/permalink. However, when I set up permalinks without the index.php, I simply get a white page with no source whatsover. If I go back to the settings and enter a custom structure to include index.php in the permalink it works. My site is behind a firewall right now, so there’s no public access, but I was wondering if anyone could help. I can’t figure out if this is an issue with the way the server is handling the rewrites or if it’s something in WordPress.

    This is the location block in my config for the rewrites:

    location / {
    		# if you're just using wordpress and don't want extra rewrites
    		# then replace the word @rewrites with /index.php
    		try_files $uri $uri/ @rewrites;
    
                    # pretty permalinks for WordPress
                    if (!-e $request_filename) {
                    rewrite ^.*$ /index.php last;
             }

    I have looked at the http headers, and it does appear that the server is throwing a 404 error, but everything I’ve found on the net, says combining the above config with the nginx compatibility plugin should fix this issue.

    Thanks in advance for any help!

    Philip

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Philip

    (@philipwalter)

    Guess this is a topic no one wants to touch? It’s frustrating because I seem to have found some answers but none are working.

    Any ideas on how to begin troubleshooting?

    Philip

    Thread Starter Philip

    (@philipwalter)

    Okay, I figured out the issue, for anyone interested. The “if” statement in the code above isn’t necessary at all, and I’m serving WP out of a subdir, so I needed to specify that in the location block for the rewrites to function properly. Here’s the new location block:

    location /blog {
    		# if you're just using wordpress and don't want extra rewrites
    		# then replace the word @rewrites with /index.php
    		try_files $uri $uri/ /blog/index.php;
    
             }

    Philip

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pretty Permalinks on Nginx’ is closed to new replies.