How to make subdomain point to a custom folder with Laravel installed in the root?

Published

I have Laravel installed in public_html folder and I have a subdomain x.example.com when I open it, I get This site can’t be reached and when I navigate to example.com/x it worked. How to make the subdomain point or map to this path and ignore Laravel routing? I tried

RewriteCond %{HTTP_HOST} ^x.example.com
RewriteCond %{REQUEST_URI} !^/x/
RewriteRule (.*) /x/$1 [L]

before Laravel redirection

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

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

But it didn’t work

Source: Laravel

Published
Categorised as laravel, redirect, routes, subdomain Tagged , , ,

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq