Jump to content

NGINX FURL re-write rules.


ParadigmX

Recommended Posts

Hi, tried doing a search for re-write rules for nginx but couldn't find a solid consensus. Anyone know what I should be using? currently I have the following:

 

 location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.php?$args;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

 

Link to comment
Share on other sites

  location / {
    try_files $uri $uri/ /index.php;
  }

  location ~^(/page/).*(.php)$ {
    try_files  $uri $uri/ /index.php;
  }

That is what is in my "site-available" config file for the forum, and friendly URLs are working.

Friendly URL's display correctly, but a 404 file/path results in a loop.  For example, www.mysite123123.com/this-url-doesnt-exist results in a redirect loop.  What about you?  What should happen is like what happens on this site:

https://community.invisionpower.com/123123123

 

Link to comment
Share on other sites

  location / {
    try_files $uri $uri/ /index.php;
  }

  location ~^(/page/).*(.php)$ {
    try_files  $uri $uri/ /index.php;
  }

That is what is in my "site-available" config file for the forum, and friendly URLs are working.

Strange, when adding this to my nginx config it appears to break the URL structure.

Forums are linked on the index as: https://mydevsiteurl/forums/forum/2-an-example-forum/ ... shouldn't it be just, "https://mydevsiteurl/forum/2-an-example-forum/"

 

Why is it showing FORUMS instead of forum in the URL? My IPB3 install is siteurl.tld/forum/this-is-a-forum .

 

I'd submit a ticket asking this but they will not provide support for test installs, only live installs.

Link to comment
Share on other sites

Ignore the above post. Got that figured out (had to change the URL structure in the Advanced Configuration --> Friendly URLs to remove all mentions of "forums" from the rewritten URLs. Now a new problem. For some reason the configuration and rewrite rules still require the 'index.php' to be part of the URL... any idea on how to fix this?

Link to comment
Share on other sites

Ignore the above post. Got that figured out (had to change the URL structure in the Advanced Configuration --> Friendly URLs to remove all mentions of "forums" from the rewritten URLs. Now a new problem. For some reason the configuration and rewrite rules still require the 'index.php' to be part of the URL... any idea on how to fix this?

Have you enabled "Rewrite URLs" in System > Search Engine Optimisation?

Link to comment
Share on other sites

Have you enabled "Rewrite URLs" in System > Search Engine Optimisation?

 

When I do that, I get a 404 error with the rewrite rules mentioned in this thread.

Otherwise they 'work' with that disabled but it prints index.php in the URL structure if I have that setting disabled.

 

Link to comment
Share on other sites

 

When I do that, I get a 404 error with the rewrite rules mentioned in this thread.

Otherwise they 'work' with that disabled but it prints index.php in the URL structure if I have that setting disabled.

 

I setup my forum as the 'root' for IPB, it looks like maybe you have it set differently which is why you had a nested site.com/forum/forum URL structure.  I'm not certain, still new to IPB.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...