HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

Recent Discussions Link has backslash in it (index.php?p=/\discussions)

Hi,

I've just upgraded from 2.5.1 to 2.8.1. I followed the instructions regarding the upgrade, files to delete etc.

I have the issue (and this was in place before upgrade I think) where the RecentDiscussions link contains a backslash:

index.php?p=/\discussions

I also, as you can see, still have the issue of using ?p= links. I tried to follow the steps to ensure that pretty URLs are used, but it doesn't seem to have taken effect.

I should note this is hosted in IIS.

Appreciate any assistance that people can give!

Cheers.

Comments

  • hynseyhynsey New
    edited March 2019

    OK, so a bit of progress. I added this line to the config.php file (even though the upgrade instructions said to remove if present, which it wasn't):

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

    No all urls are pretty and nice, except the recent discussions link links to https://discussions . All other links appear fine.

    On IIS, I have this web.config entry for url rewrites:

    <rewrite>
         <rules>		  
          <rule name="Vanilla Rule 1" stopProcessing="true">
           <match url="^(.*)$" ignoreCase="false" />
           <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
           </conditions>
           <action type="Rewrite" url="index.php\?p={R:1}" appendQueryString="true" />
          </rule>
         </rules>
        </rewrite>
    

    Anyone got any ideas? :)

  • ShadowdareShadowdare Moderator
    edited March 2019

    I'm running a Vanilla 2.8.1 forum on IIS as well. See a post I recently wrote about my initial setup here: https://open.vanillaforums.com/discussion/comment/256031/#Comment_256031

    Here is the rewrite rule I use for routing to index.php:

    <rewrite>
       <rules>
          <rule name="Vanilla route controllers to index.php">
             <match url=".*" />
             <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
             </conditions>
             <action type="Rewrite" url="index.php/{R:0}" />
          </rule>
       </rules>
    </rewrite>
    

    Setting Garden.RewriteUrls setting in config.php to true still works for now, but I bet they will switch to using only the X_REWRITE environment variable to enable URL rewrites in the future. What I do is put the site that's running Vanilla in IIS in its own application pool.

    You can set an environment variable specifically to an app pool by going to the IIS root -> Configuration Editor -> enter section "system.applicationHost/applicationPools" and open (Collections) -> click on your app pool to see its properties -> click environmentVariables -> add a variable named X_REWRITE with value of 1.

    A quicker way to do is set it via this command in the command prompt or PowerShell (change MyVanillaAppPool to your app pool's name):

    appcmd.axe set config -section:system.applicationHost/applicationPools /+"[name='MyVanillaAppPool'].environmentVariables.[name='X_REWRITE',value='1']" /commit:apphost
    

    Edit: replace appcmd.axe (axe part with e instead of a) (for some reason the Cloudflare settings here prevents me from typing it out).

    Add Pages to Vanilla with the Basic Pages app

  • ShadowdareShadowdare Moderator
    edited March 2019

    I also see the bug with the discussions link being outputted as "https://discussions", but only in the sidebar menu (DiscussionFilter module). The links seems fine in the header menu and in other places. Is it just happening in the sidebar for you too? I investigated the issue and filed a bug report on GitHub here: https://github.com/vanilla/vanilla/issues/8551

    Add Pages to Vanilla with the Basic Pages app

  • Hi Shadowdare,

    Apologies I thought I had notifications on for comments on my discussions, but I didn't. Yes, this is only in the sidebar for me.

    I've just checked the bug report has been closed 17 days ago as it's gone stale :( Did you get anywhere on this?

    I've since upgraded to 3.2 and still face the same issue.

    Cheers.

Sign In or Register to comment.