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

fluxxus's avatar

Install Laravel on top of existing PHP website

Hola! I am wondering is it possible to install Laravel on top of existing simple PHP website, but without migrating old pages to Laravel?

The main issue is SEO, and my client would like to keep everything old intact. The site ranks highly and he doesn't want to ruin 10+ years of work that went into building SEO for the website.

There are some planned additions to the website, and using a framework like Laravel would help greatly with those. Is it possible to have best of both worlds, keep old pages intact and use Laravel for everything new?

P.S. Current website has no routing, templates, etc. Around 100 pages, some of which don't use PHP at all. Stripe integrated for managing payments, Directus acts as headless CMS for blog posts. Overall pretty much simple website.

0 likes
5 replies
martinbean's avatar

@fluxxus Put the “old” site in the public directory of your Laravel application. Set up your web server to first check for a file, and only if a file does not exist, to pass the request through Laravel.

The .htaccess file that ships with Laravel does this already:

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

That checks the request does not match a directory or file, before passing the request to Laravel’s index.php front controller. You’ll be able to do something similar with nginx too if you use that instead.

If you already have an index.php file for your existing website, then you could rename Laravel’s to say, index-laravel.php and then update the .htaccess / nginx.conf rule:

# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index-laravel.php [L]

Once you do have Laravel installed and your old website working together in tandem, I would make an effort to start migrating pages to Laravel. You can do them one at a time to ensure that the output is same from the “old” site to the Laravel-served, Blade version.

2 likes
fluxxus's avatar

@martinbean Thanks, appreciate the help. I will definitely try this, it looks to be exactly what I need.

I hear you on effort to migrate everything to Laravel over time. But the main concern here is my client's fears of messing up SEO if we change how things are working right now.

I will need to do more research on this, migrating will be only possible if we are 100% certain it won't mess up SEO.

Thanks again, I'll report back once it is done.

martinbean's avatar

@fluxxus Your SEO isn’t going to be “messed up” if you serve the exact same HTML from a Laravel controller, though?

It’s why I suggest doing pages one at a time, so you can check that the same HTML is getting returned after converting to a Laravel response.

Google et al don’t care (or even know) what server-side framework you‘re using to return HTML, or if you’re using one at all. You’re not going to get penalised if you start serving the same HTML document from Laravel instead of a vanilla PHP script, so long as the content and URL is the same.

fluxxus's avatar

@thinkverse I will have a look at the article, I think I saw it before when researching on this topic. Thx!

Please or to participate in this conversation.