Support the ongoing development of Laravel.io →
Configuration
Last updated 2 years ago.
0

Hey Buddy,

Thank you. I had the same issue. Can you please explain why this happened?

Last updated 2 years ago.
0

I think it's due to the VirtualDocumentRoot that I use and the regex that is used in the rewrite rule for the replacement. But I'm not 100% certain to be honest.

Although now that I look at it, I think the Laravel 4 version should be the below, as otherwise I'm not using the search.

RewriteRule ^(.+)$ /index.php/$1 [L] 

My vhost config is:

NameVirtualHost *:80


<Virtualhost *:80>
    UseCanonicalName Off
    VirtualDocumentRoot "/path/to/general/directory/%-3+/public"
    ServerName vhosts.loc.al
    ServerAlias *.loc.al
	LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
    ErrorLog "/path/to/general/directory/log/error_log"
    <Directory "/path/to/general/directory/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</Virtualhost>

I'm not a regex / vhost guru though, so maybe I'll post an issue on GitHub.

Glad it helped you though.

Last updated 2 years ago.
0

thank you for your time buddy.

Last updated 2 years ago.
0

Thank you! Had the same issue and your solution worked very well for a L4 installation with wildcard subdomain enabled on domainfactory (df.eu).

Last updated 2 years ago.
0

Thank you, thank you, thank you, thank you.

Need I say more?

Last updated 2 years ago.
0

Fixed like magic. Thank you so much !!

Last updated 2 years ago.
0

This is how my .htaccess looks like.

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/public/.*$

RewriteRule ^(.*)$ /public/$1 [QSA,L] 

It worked fine before on both local and production servers. Now, it doesn't work on the production server. Same as yours, the '/' page is displayed, but the other pages generate 500 error. Using the code rajanrawal suggested produced 403 error on all the pages

Last updated 2 years ago.
0

I'm not 100% sure if this is the same problem, but I had similar symptoms (local setup worked fine, on a host it gave a 500 internal server error for everything but '/'). I added this line to the .htaccess

RewriteBase /

(after "RewriteEngine On" line) which worked and now both local and host don't show any errors. I read about this solution somewhere, but that was a year ago or so - so I'm not sure where (I just started a new Laravel project and so had the convenience to check an old Laravel project which already works).

Last updated 2 years ago.
0

Thank you oadria!

You fixed my issue. I push a Laravel 5 instalation to live server and I started getting the 500 error. Adding that line in my .htaccess fixed that.

I think that rule should come by default . What do you think?

0

OMG, thanks @oadria, my issue was fixed. Now, I can do my demos like a Pro !!!

0

THANKS! Same thing happening on a Laravel 5 install when using virtual hosts. Simple change, and now routes are working.

0

visualasparagus said:

Hello,

I was receiving a 500 Internal Server Error for all routes other than '/'. After looking at the error log, I saw the following.

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

I had recently changed my local setup to support wildcard dns and wildcard vhosts and I noticed this also happened with an old laravel 3 project as well. This was obviously an vhost or .htaccess issue.

After looking around I found a solution that suggested a change to the RewriteRule. All works fine now. My question is if anyone sees a problem with this rewrite rule, and if not, perhaps it's a good idea to change the standard .htaccess file?

#Laravel 3

RewriteRule ^(.*)$ index.php/$1 [L]

RewriteRule ^(.+)$ /index.php/$1 [L]

#Laravel 4

#RewriteRule ^ index.php [L] RewriteRule ^(.+)$ /index.php [L]

Thanks, but what is the command for laravel 5?

0

oadria said:

I'm not 100% sure if this is the same problem, but I had similar symptoms (local setup worked fine, on a host it gave a 500 internal server error for everything but '/'). I added this line to the .htaccess

RewriteBase /

(after "RewriteEngine On" line) which worked and now both local and host don't show any errors. I read about this solution somewhere, but that was a year ago or so - so I'm not sure where (I just started a new Laravel project and so had the convenience to check an old Laravel project which already works).

THANK YOU i was searching and searching for a similar issue with the mod rewrite for production routing of any links after the / or home page, changed my .htaccess file in public from RewriteBase /home/me/public_html/blog/public to RewriteBase / and it all works as it did under homestead in development so a big thank you and anyone with a similar sounding issue in Laravel 5 here is a confirmed fix.

0

@oadria

You've solved this for me as well. RewriteBase / Solved for me.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.