Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rickyspires's avatar

Cant not get .htaccess to work ?

Hello.

I have spent the whole day on this a could really use some help please.

I am trying to get my laravel site to run on a Digital Ocean Ubuntu 14.4 server running php 5.5.9 and apache2.

I have looked at the docs and various tutorials but i have had no luck.

When i go to mysite/phpinfo.php I can see in loaded modules "mod_rewrite"

My server file structure is /var/www/html The index and .htaccess files are in the default place /var/www/html/public

my .htaccess was the default one supplied:

<IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews
        </IfModule>

        RewriteEngine On

        # Redirect Trailing Slashes...
        RewriteRule ^(.*)/$ /$1 [L,R=301]

        # Handle Front Controller...
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
</IfModule>

But that did not work so I tried the other one that is in the Laravel docs and that didnt work either:

<IfModule mod_rewrite.c>
        Options +FollowSymLinks
        RewriteEngine On

        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
</IfModule>

In my Digital Ocean server I have set up another user some instead of root it is rickyspires.

This is my set up there.

$ sudo a2enmod rewrite $ sudo service apache2 restart $ sudo nano /etc/apache2/sites-available/000-default.conf

<VirtualHost *>
    ServerAdmin rickyspires@localhost
    
    DocumentRoot /var/www/html/
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /var/www/html/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

</VirtualHost>
  • When I go to my domain it shows a list of all the files in /var/www/html/

Thanks Ricky

0 likes
8 replies
jasonfrye's avatar

You need to point your doc root to the public folder.

rickyspires's avatar

Hello.

Thanks. that worked but now I have a php error

Notice: Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /var/www/html/config/app.php on line 83

Any ideas ?

jasonfrye's avatar

You need to have mcrypt installed with php.

sudo apt-get install php5-mcrypt

rickyspires's avatar

ok. Fixed that with : sudo php5enmod mcrypt sudo service apache2 restart

But now I have a blank white page

jasonfrye's avatar

Check your apache logs to see what the error is. Could be permissions on your storage folder or something else.

jasonfrye's avatar
Level 9

My hunch is permissions problem. Probably need to change the storage folder to 777 or 755 if the folder is owned by the same user that runs apache.

jasonfrye's avatar

By the way, you checked errors in your /var/log/apache2 folder as well as in your storage/logs folder inside laravel?

Please or to participate in this conversation.