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.

.htaccess with LAMP Stack (Ubuntu), Yet Another Pretty URLs Question

LarkLark
edited June 2013 in Vanilla 2.0 - 2.8

Like everyone else on this forum, I'm having issues with getting pretty url's to work for me. I'm trying to run a copy of 2.0.18.8 on Ubuntu (11.10). It's a fresh install on localhost, so I have access to everything. My google-fu has failed me though, since I feel as if I've tried everything I could find here and on ubuntu/apache's sites.

I have the default .htaccesss file located in my public_html/old_forum/ folder, and one that I modified in /public_html/ with RewriteBase /old_forums uncommented. (I know that the /old_forums/.htaccess should overwrite it, but I was willing to try anything.) Both copies are readable by all.

The default .htaccess in public_html/old_forums looks like this, on the off-chance that something got changed :

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

In my public_html/old_forums/conf/config.php file, I have $Configuration['Garden']['RewriteUrls'] = TRUE;.

Ubuntu docs (https://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles) told me change the AllowOverride All within my sites-available config file in /etc/apache2/sites-available/forums). The complete file looks like this:

<VirtualHost *:80>
        ServerAdmin [email protected]

        DocumentRoot /home/username/public_html/
        <Directory />
            Options FollowSymLinks
            AllowOverride All 
        </Directory>
        <Directory /home/username/public_html>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All 
            Order allow,deny
            allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>

</VirtualHost>

The site is enabled, the apache default is disabled. It worked fine without pretty URLs, but I can't for my life get rewrite working. Anyone have anything left that I can try or change? I'm pretty much out of ideas, and all roads lead to 404 errors.

Best Answer

Answers

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    what permissions on the htaccess file? 666 ?

    have you tried AllowOverride all on all ?

  • Permissions on the .htacess are 766.

    The code above is what I have for the AllowOverride. Do you mean in all the places where there is AllowOverride, change it to AllowOverride all? (So, in the above change within ScriptAlias and Alias.) I'll try that.

    I had only changed the sites-enabled apache file that corresponded to my public_html directory. The default and default-ssh were for var/www, if those are what you're talking about, but those are disabled.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    use 666 permission on the htaccess file

  • I set everything to all, and downgraded the permissions to 666. No change.

Sign In or Register to comment.