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.

Rewrite URL problem in fresh installation

kate1138kate1138 New
edited July 2017 in Vanilla 2.0 - 2.8

Apologies I saw similar question asked a few times here. But I still can't figure out.

After unzip the installation files, updating RewriteBase line in .htaccess file, and chown to apache user -

I am able to access the initial installer page at
http://mydomain/forum/index.php?p=/dashboard/setup
but not
http://mydomain/forum/dashboard/setup

I can't proceed the installation using the parameter URL. What should I do to fix the substitute URL?

My .htaccess file:

# Modified
# 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 /forum

    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>

Answers

  • kate1138kate1138 New
    edited July 2017

    Thank you for the quick response.

    No it doesn't work. I tried replacing the entire .htaccess file with the below from the other post, it doesn't work. I tried using the below text but change RewriteBase to /forum, still same 404 error.

    # Modified
    # 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 or whatever name you have given your forum if in a subdirectory)
       RewriteBase /
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
    </IfModule>
    

    Contrary to what I imagined, http://mydomain/forum/index.php?p=/dashboard/setup works both under RewriteBase / and RewriteBase /forum.

  • You also need to add a configuration to allow rewrite URL . Add the line bellow to the config.php both of these need to exist in order for rewrite to work.

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

  • Hi - I do not have a config.php under conf folder. It is something you have after you have run installer? I tried to add the line to config-defaults.php, but I still get the same error.

  • The config gets generated after set up you need to go through set up to generate the config

    Your site.com/setup

  • Since I can't get through the installer, what would you suggest I do to fix?

    I'm still in the same situation:

    http://mysite/forum/index.php?p=/dashboard/setup shows the installer but throws 404 after I submit the form.

    http://mysite/forum/dashboard/setup throws 404.

    Tried replacing .htaccess with the referred post, tried to enable rewriteURL in config-defaults.php, all the tweaks yield same result.

    There is no error log in php error log. Is there anything else I should look or provide?

  • What php version are you running and or is the rewrite Module enabled ?

  • It's PHP 7. And I think rewrite is enabled:

    ~$ php -v
    PHP 7.0.18-0ubuntu0.16.04.1 (cli) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
        with Zend OPcache v7.0.18-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies
    ~$ sudo a2enmod rewrite
    Module rewrite already enabled
    
  • R_JR_J Admin

    You would at least be able to install Vanilla if you add $Configuration['Garden']['RewriteUrls'] = false; to your /conf/config-defaults.php

    Obviously you wouldn't be able to use pretty urls from the start and you should trying to solve that issue, but it would get you started and make your first experiences with Vanilla.

    After the installation, you should delete that line from config-defaults.php and move it over to config.php where you set it to true.
    With the short .htaccess that vrijvlinder has linked to (changed so that is reads RewriteBase /forum) you should be able to use Vanilla with pretty urls.

    At least that is what we all hope... :wink:

Sign In or Register to comment.