7

My client recently purchased a linux 1&1 unlimited package from 1and1.com hosting company. I built the application for him in Laravel 4.2 framework. The application is working absolutely fine on my local machine as well as on my own VPS. But when I setup the files on my client host, it looks like .htaccess file is not working. Thats why, the laravel routes are not working and I'm constantly getting the 404 error message when trying to access different routes of the site.

I've researched a lot about this issue and find many people heading with the same issue but couldn't find the real solution to this problem.

Here is the .htaccess code:

<IfModule mod_rewrite.c>
  Options -MultiViews
  RewriteEngine On

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

I'm using Laravel 4.2

3
  • 1
    is mod_rewrite enabled on the server? is your vhost pointing to public folder ?
    – DouglasDC3
    Feb 25, 2015 at 12:31
  • I can not really say because I mentioned that my client bought this shared hosting from 1and1.com and I don't have any access to their httpd.conf file Feb 25, 2015 at 12:45
  • 1
    Take a look at this answer.
    – Bogdan
    Feb 25, 2015 at 13:01

4 Answers 4

16

I encountered the same problem on my 1&1 hosted solution. I suggest adding:

RewriteBase /

that worked for me.

All the best, M

1
3

I use Laravel 5.2, thanks, it works for me also, thanks I added RewriteBase to my .htaccess file

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

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

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

This worked for me, just following contents are in my .htaccess

RewriteBase /

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
0

I use Laravel 10x, it works for me too. I'm using ionos hosting

<IfModule mod_rewrite.c>
RewriteBase /

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

RewriteEngine On

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.