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

Clicking on forum root leads to error 404

When I click on the link to the forum root (default template, breadcrumb navigation right under the title/banner) I get an error #404 (NOT from Vanilla Forums but directly from my server), saying the page couldn't be found. I run the Vanilla Forums software in a subfolder of a domain. The link looks like this:

http://www.domain.com/forums/index.php?p=/

As long as there is something after --> ?p=/ <-- I receive whether the specific page or (if it doesn't exist) an error #404, but this time from Vanilla Forums, nicely displayed in the theme.

What could be the problem? My .htaccess looks like this:

# Original
# If you modify this file then change the above line to: # Modified

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Certain hosts may require the following line.
    # If vanilla is in a subfolder then you need to specify it after the /.
    # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
    # RewriteBase /

    RewriteCond %{QUERY_STRING} ^p=/?([^&]+)(&([^?]+))?$
    RewriteRule ^index\.php %1?%3 [E=X_REWRITE:1,L]

    # The basic rewrite rule.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [QSA,E=X_REWRITE:1,E=X_PATH_INFO:/$1,L]

    # Add the proper X_REWRITE server variable for rewritten requests.
    RewriteCond %{ENV:REDIRECT_X_REWRITE} .+
    RewriteCond %{ENV:REDIRECT_X_PATH_INFO} (.+)
    RewriteRule ^index\.php - [QSA,E=X_REWRITE:1,E=!REDIRECT_X_REWRITE,E=X_PATH_INFO:%1,E=!REDIRECT_X_PATH_INFO,L]

    # 301 redirect urls that start with index.php
    #RewriteCond %{REQUEST_METHOD} GET [NC]
    #RewriteCond %{REQUEST_URI} ^(.*?)/index\.php(.*)$
    #RewriteRule ^index\.php /%1%2 [QSA,R,L]
</IfModule>

<IfModule mod_headers.c>
   <FilesMatch "(?<!embed)\.(css|js|woff|ttf|eot|svg|png|gif|jpeg|jpg|ico|swf)$">
      Header set Cache-Control "max-age=315360000"
      Header set Expires "31 December 2037 23:59:59 GMT"
   </FilesMatch>
</IfModule>

Comments

  • Well, I have a solution for the problem, even though it's more of a workaround.

    1. I made a copy of applications/dashboard/views/default.master.tpl
    2. I placed the copied file in themes/default/views [I created the folder "views" to do that].
    3. I edited the file and searched for the breadcrumbs part, added the homeurl="" part and defined it manually (see documentation: http://docs.vanillaforums.com/developer/theming/smarty/functions/breadcrumbs/)

    Now the link works fine but maybe this problem can be solved differently, just wanted to share my solution for it and hope anyone who comes across this problem now knows what to do in this situation.

  • RiverRiver MVP
    edited September 2016

    @core71 said:
    When I click on the link to the forum root (default template, breadcrumb navigation right under the title/banner) I get an error #404 (NOT from Vanilla Forums but directly from my server), saying the page couldn't be found. I run the Vanilla Forums software in a subfolder of a domain. The link looks like this:

    http://www.domain.com/forums/index.php?p=/

    As long as there is something after --> ?p=/ <-- I receive whether the specific page or (if it doesn't exist) an error #404, but this time from Vanilla Forums, nicely displayed in the theme.

    What could be the problem? My .htaccess looks like this:

    # Original
    # If you modify this file then change the above line to: # Modified
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    

    # Certain hosts may require the following line.
    # If vanilla is in a subfolder then you need to specify it after the /.
    # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)

    Hmmm.

    the line below is for you to edit and uncomment.

    > # RewriteBase /


    if you use apache or a web server that reads .htaccess and your goal is to rewrite url's which you will need to do for most things to work correctly
    then read this...

    https://vanillaforums.org/discussion/comment/220157/#Comment_220157 question 22.

    if you are new you might read this: https://vanillaforums.org/discussion/28420/frequently-asked-questions

    but then again: read this https://vanillaforums.org/discussion/comment/243458/#Comment_243458

    and then read this: https://vanillaforums.org/discussion/comment/243460/#Comment_243460

    Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.

  • @core71 said:
    Well, I have a solution for the problem, even though it's more of a workaround.

    1. I made a copy of applications/dashboard/views/default.master.tpl
    2. I placed the copied file in themes/default/views [I created the folder "views" to do that].
    3. I edited the file and searched for the breadcrumbs part, added the homeurl="" part and defined it manually (see documentation: http://docs.vanillaforums.com/developer/theming/smarty/functions/breadcrumbs/)

    Now the link works fine but maybe this problem can be solved differently, just wanted to share my solution for it and hope anyone who comes across this problem now knows what to do in this situation.

    I'm having the same problem. I modified the RewriteBase / in the .htaccess but that doesn't seem to help.

    Could you share more details about how you modified the breadcrumbs part to add the homeurl="" to themes/default/views/default.master.tpl ?

    Thanks!

  • UPDATE: I did figure out how to make the breadcrumbs work but that didn't completely solve my problem.

    I'm using Vanilla forums embed comments with Codeigniter which also uses a .htaccess with rewrite rules. I'm thinking that the two different .htaccess rules maybe conflicting.

    However, I did manage to get my embed forum working properly by replacing the javascript Universal Forum Embed Code with an iframe using bootstrap 3.3.7 styled to be responsive :

    <div class="embed-responsive embed-responsive-4by3">
       <iframe class="embed-responsive-item" src="http://www.domain.com/vanilla/"></iframe>
    </div>
    
  • I just updated to v2.3 and came across this very similar error.

    The previous installation always used index.php/p= URLs. After copying all the files I got 404 errors to the utility/upgrade URL in the README.md file. I was able to bypass this by issuing an index.php/p=/utility/update URL and updated the database, still not realizing what the actual problem was.

    I am using Apache web server. The website was not configured to allow .htaccess Overrides. Essentially my website configuration was ignoring the commands to enable mod_rewrite in the .htaccess file. Creating an Allow Overrides All to my directive in the Apache configuration, then configuring RewriteBase to the proper folder Vanilla is installed to fix the 404 Errors.

Sign In or Register to comment.