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.
Options

Friendly urls broken at apache level (I think), but I can't find the problem.

monstomonsto
edited February 2014 in Vanilla 2.0 - 2.8

I set $Configuration['Garden']['RewriteUrls'] = TRUE; and then using any link that goes anywhere but / generates a 404 "The requested URL /discussions was not found on this server."

here's my htaccess.

# 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 /var/www/site.com/html/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
</IfModule>

I tried and untried the RewriteBase line a couple times with different settings, but generally it's commented.

it seems that since the msg is a 404 and not a bonk, that it's apache and not vanilla. mod_rewrite is enabled, and htaccess appears to be working (the urls I get from links appear to be appropriate).

What am I missing that's preventing friendly urls from working? I've searched, but "friendly urls" doesn't yield anything relevant.

Comments

  • Options
    peregrineperegrine MVP
    edited February 2014

    what version of vanilla?

    what folder did you place the .htaccess in?

    where is your forum located.

    e.g. www.example.com/forum

    if it is in forum

    use

    RewriteBase /forum

    apache has documentation as well.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    what version of vanilla?

    Version 2.0.18.10

    what folder did you place the .htaccess in?

    it has not been moved from the default placement which is in the installed root and the apache Document Root

    where is your forum located.

    the filepath is /var/www/site.com/html which is configured in apache as the Document Root. Therefore, I would expect RewriteBase / to work.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    so when I visit you forum I type this into the address bar and it gives me your forum ?

    www/site.com/html

    Yea I am not sure how you installed this.

    WP and Vanilla have their own htaccess files .

    You must install them in separate folders example :

    www/site.com/blog

    www/site.com/forum

    then the htaccess for the Vanilla would be

    /forum

    the htaccess for WP

    /blog

    or if it is in the root

    WP in the root

    /

    Vanilla in subdirectory

    /forum

    You can't have both in the same folder without some major tweaking...

  • Options

    so when I visit you forum I type this into the address bar and it gives me your forum ? www/site.com/html

    No. /var/www/site.com/html is the apache Document Root. It's where I put index.html. when you go to http://site.com you get index.html

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    Is Vanilla in it's own folder and what is it called ?

    What is your WP called is it in it's own folder or the root?

    if you installed Vanilla in the root along with wordpress you are going to have an issue.

    You need to install Vanilla or wordpress in a separate folder from each other. Do you understand ?

    I installed WP in the root and use it as my index/landing page

    then I installed vanilla in a folder Called Forum.

    so my site is /

    my forum is /forum

    whatever the url is to your site .

  • Options

    vanilla is in it's own folder, the document root. The main index of vanilla appears at site.com/

    There is no wordpress. It's not part of any config here, it's not installed.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited February 2014

    Is Vanilla the only thing in your root?

    Do you have another index page in the root ?

    If you installed vanilla in the root then when I go to your site I should see the forum.

    If you have another index page in the root, remove it or put vanilla in another folder and call it forum or whatever.

    Look at the tutorial for 404 error to put in the right htaccess file content.

    it needs to look like this and in the config Rewrite Urls True

    # 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 /
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteRule ^(.*)$ index.php\?p=$1 [QSA,L]
    </IfModule>
    
  • Options
    monstomonsto
    edited February 2014

    Vanilla is the only thing installed to show when you go to my site in any way. I'm not sure what else I can say to that effect. . . there's no other cms or forum, vanilla isn't embedded in anything. I have not modified anything except the list of Categories. This is a stock installation of vanilla with 2 themes installed and not used. It's about as plain as it can get.

    The .htaccess is exactly as your paste; which is different from my original post only by the RewriteBase item.

    When the rewrite config item is TRUE, and I click the Discussion link, it goes to site.com/discussions and throws a 404. When it is false, it goes to site.com/index.php?p=/discussions and works.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    the htaccess and the config must both be true. If you want clean urls. Apache's mod_rewrite comes as standard with most Apache hosting accounts, so if you're on shared hosting, you are unlikely to have to do anything except these small changes depending on where you installed in your directory. But I would contact the host and see anyway if there is anything they can do.

    You can try installing another vanilla in a subdirectory and see if the same thing happens ?

    http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

  • Options

    It's not shared hosting, it's my own server with my own config. mod_rewrite is enabled in an otherwise stock apache install.

    the htaccess and the config must both be true.

    There's a "true" setting in the .htaccess?

    When I set the vanilla config to rewrite true.

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

    With the .htaccess as shown above, it creates the 404.

    I can appreciate that you guys get a number of requests for help where people say that "it's a default install!" only to find out thru basic Q&A that it's installed concurrently with drupal, an FTP server, a quake 2 game server and a torrent site, but I assure you that my install is quite basic. I have full control of a VM that was installed at a friends data center as if I were a normal customer. It's a base 'web host' setup which includes apache, mysql, a couple other common apps, and webmin. I'm not the best linux admin in the world but I can troubleshoot and google problems as needed. My original feeling that it was an apache problem was because it was a 404 and not a Bonk. I thought you guys might be able to tell me where I could check.

    I assure you, this is a basic install. I wget the file, unarchived it into the directory, ran the setup and followed the instructions. With the exception of themes not working (which was fixed by additional chmod that wasn't noted in any of the instructions grrrr) I have made no changes to the default install of the site.

    I have it installed at the path /var/www/site.com/html/ which is the apache document root, the site appears at site.com/, and only 404s after activating 'RewriteUrls' parameter.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    Yes what I mean is the htaccess has to have Rewrite engine on and pointing to your root / and also have in the vanilla config Rewrite Urls True

    If you are using Apache2 on a Debian-based distribution, you need to run the following command and then restart Apache:

    sudo a2enmod rewrite

    Other distubutions and platforms differ. If the above instructions are not suitable for your system, then Google is your friend. You may need to edit your apache2 configuration file and add "rewrite" to the "APACHE_MODULES" list, or edit httpd.conf, or even download and compile mod_rewrite yourself. For the majority, however, installation should be simple.

  • Options

    'mod_rewrite' is enabled (as said in the original post), Rewrite Engine is On in the htaccess (as shown in the original post), RewriteBase is /, the config has RewriteURLS to TRUE. I restart apache whenever a change is made to either it's global config or the htaccess. There is no other webapp in the dir with vanilla, and it is installed so that it appears at the top of the domain. I've said all of this earlier in the thread.

  • Options

    the simplest thing to do is change [QSA,L] to [QSA,R]

    then when you put the friendly url, it will do a permanent rather than internal redirect, therefore you will find out exactly were ti is redirecting to then you can adjust.

    grep is your friend.

  • Options
    hgtonighthgtonight ∞ · New Moderator
    edited February 2014

    I don't think I have seen you before, but welcome back to the community!

    I assume this is an actual 404 and not a soft Vanilla 404?

    Do you meet the requirements otherwise? http://vanillaforums.org/docs/installation-requirements

    I also assume you read through this? http://vanillaforums.org/discussion/25552/tutorial-diagnose-page-not-found-404-errors

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    the simplest thing to do is change [QSA,L] to [QSA,R]

    I will try this and report back.

    I assume this is an actual 404 and not a soft Vanilla 404?

    a quote the first post:

    it seems that since the msg is a 404 and not a bonk, that it's apache and not vanilla.

    Do you meet the requirements otherwise? http://vanillaforums.org/docs/installation-requirements

    Yes.

    Had not seen that, but the information is no different than the overnight discussion I had with vrijvlinder.

  • Options
    monstomonsto
    edited February 2014

    the simplest thing to do is change [QSA,L] to [QSA,R]

    This yielded no change. site.com/ shows vanilla, Discussions link links to site.com/discussions and that link gives a 404 when used.

    ... altho I can't help but feel this is headed in the right direction. can you think of anything else i could check/change in the apache config?

  • Options

    grep is your friend.

  • Options

    AllowOverride All

    That was it right there. I swear I had looked at the directives ten hundred times, but I guess I just looked right past a missing line.

    Second set of eyes. Well done and Thanks.

  • Options
    hgtonighthgtonight ∞ · New Moderator

    @monsto I am glad @x00 sorted you out.

    Apache configuration is definitely not my forté.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.