Please upgrade to 2.1.x here. The 2.0 branch is no longer being updated.
Current version is 2.1.11, released 12 June.

Pretty URLs or how do I get rid of: 'index.php?p=/' on nginx?

edited March 2013 in Vanilla 2.0 Help

After a fresh move to a local vanilla installation, my routes are all ugly:

forum/index.php?p=/discussions/etc...etc...

How can I change these to pretty urls? Like:

forum/discussions/etc.. etc...

How do I make 'index.php?p=/' disappear?

Best Answer

  • edited December 2011 Answer ✓

    OK boys:

    The fix to my problem turned out to be relatively simple.

    Addition to nginx config file:


    location /forum {try_files $uri $uri/ @forum;}


    location @forum {rewrite ^/forum(.+)$ /forum/index.php?p=$1 last;}

    Restart nginx.

    Change false to true in the Vanilla conf file:


    $Configuration['Garden']['RewriteUrls'] = TRUE;

Answers

  • ToddTodd Chief Product Officer Vanilla Staff
    edited December 2011

    Two things:

    1. Make sure pretty urls will work for your site. You can do this by browsing to a few pretty urls and make sure they come up properly.
    2. Edit the following config setting:
      $Configuration['Garden']['RewriteUrls'] = TRUE;
  • This blog is a sub-directory of an existing wordpress site. The wordpress site has pretty urls working, but when I try pretty urls on the forum it doesn't take.

    Any idea why?

  • ToddTodd Chief Product Officer Vanilla Staff

    You need an .htaccess file. Vanilla ships with one that works in most cases. A lot of ftp programs will ignore this file when you upload because it begins with a .. Make sure the file is there and give it another try.

  • make sure you ftp client has hidden files shown.

    grep is your friend.

  • .htaccess is there, i don't use ftp, i use scp

    I believe it is an issue with fastCGI not getting the path_info variable passed to it from nginx. i have a feeling this can only be rectified on nginx conf.

    trying some variations of what is listed here: http://vanillaforums.org/discussion/9915/vanilla-on-nginx

    will update if successful.

  • edited December 2011 Answer ✓

    OK boys:

    The fix to my problem turned out to be relatively simple.

    Addition to nginx config file:


    location /forum {try_files $uri $uri/ @forum;}


    location @forum {rewrite ^/forum(.+)$ /forum/index.php?p=$1 last;}

    Restart nginx.

    Change false to true in the Vanilla conf file:


    $Configuration['Garden']['RewriteUrls'] = TRUE;

Sign In or Register to comment.