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.

.htaccess file not working

edited December 2017 in Vanilla 2.0 - 2.8

Hi,

Not sure why, but when I install new 2.5 version .htaccess file doesn't work anymore.
I've used 2.3 version before on same server and it was working fine.
Not, every URL goes to ?p= query for some reason.

Rewrite module is enabled on server as it's working with other sites.

UPDATE:
By not working, I mean that Vanilla is generating urls like: https://domain.com/index.php?p=/categories/general, although when I manually change URL to https://domain.com/categories/general it's displaying ok.

Comments

  • Are you sure you have set $Configuration['Garden']['RewriteUrls'] = true; in your /conf/config.php?

  • Here is .htaccess

    `# Original

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


    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 /
    
    ####
    # Deny access to certain directories that SHOULD NOT be exposed.
    ####
    RewriteRule (^|/)\.git - [L,R=403]
    RewriteRule ^cache/ - [L,R=403]
    RewriteRule ^cgi-bin/ - [L,R=403]
    RewriteRule ^uploads/import/ - [L,R=403]
    RewriteRule ^vendor/ - [L,R=403]
    
    ####
    # Prevent access to any php script by redirecting the request to /index.php
    # You can add an exception by adding another RewriteCond after this one.
    # Example: RewriteCond %{REQUEST_URI} !^/yourscriptname.php$
    # You can comment out this section if it causes you problems.
    # This is just a nice to have for security purposes.
    ####
    RewriteCond %{REQUEST_URI} !^/index.php$
    RewriteRule ^(.+\.php)$ index.php [E=X_REWRITE:1,E=X_PATH_INFO:/$1,L]
    
    ####
    # Redirect any non existing file/directory to /index.php
    ####
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [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 - [E=X_REWRITE:1,E=!REDIRECT_X_REWRITE,E=X_PATH_INFO:%1,E=!REDIRECT_X_PATH_INFO,L]
    



    Header set Cache-Control "max-age=315360000"
    Header set Expires "31 December 2037 23:59:59 GMT"

    `

    I didn't setup $Configuration['Garden']['RewriteUrls'] = true; in conf.php as I thought it was by default (fresh installation of 2.5 version)

  • edited December 2017

    @R_J said:
    Are you sure you have set $Configuration['Garden']['RewriteUrls'] = true; in your /conf/config.php?

    Yeah, didn't setup this as I thought it was by default on 2.5 version.
    When I add this, it's working with URL generator, but all URLS are showing same page, "homepage".
    Whatever I click, it doesn't seem that it's processed by index.php.

  • Please try replacing your .htaccess file with e.g. the version which is mentioned here

  • @R_J said:
    Please try replacing your .htaccess file with e.g. the version which is mentioned here

    Interesting. That one worked. Does this mean that original, which is delivered with Vanilla Forum 2.5 have some error in it?

  • @smokvinlist said:
    Interesting. That one worked. Does this >mean that original, which is delivered >with Vanilla Forum 2.5 have some error >in it?

    Yes , since 2.3 not sure why but hopefully they will fix it from now on.

  • @vrijvlinder said:

    @smokvinlist said:
    Interesting. That one worked. Does this >mean that original, which is delivered >with Vanilla Forum 2.5 have some error >in it?

    Yes , since 2.3 not sure why but hopefully they will fix it from now on.

    Ok. Cool. Hope @Linc will see this thread. Thank you guys.

Sign In or Register to comment.