1

I have a Laravel app, and the document root of host is configured at Laravel root folder (upper directory of public).

I tried the following .htaccess to silently rewrite URLs, but it keeps redirecting me to /public, instead of showing domain URL and rewriting it to /public

RewriteEngine On
RewriteRule ^(.*)?$ /public$1 [L,NC]

I want to visit example.com and see my Laravel app, not redirecting user to example.com/public.

6
  • what is your operating system ? linux ? wamp on windows ? give more details Commented May 15, 2015 at 14:16
  • rather than using .htaccess to change your URLs, why don't you just use routing to achieve the URLs you want? Commented May 15, 2015 at 14:17
  • It is Linux+Apache. @JamesSpence Can you explain more? I can't understand Commented May 15, 2015 at 14:26
  • do you have access to terminal ? via ssh ? Commented May 15, 2015 at 14:30
  • No. Think of it as a shared hosting. Commented May 15, 2015 at 14:30

2 Answers 2

2

This will help you definitely : Removing the /public segment in a Laravel 4 app

http://creolab.hr/2013/03/removing-the-public-segment-in-a-laravel-4-app/

Sign up to request clarification or add additional context in comments.

2 Comments

I already said that VirtualHost is configured and I have no access to that
ohhh I didn't see that
0

Create a front controller in the document root, call it index.php. Use this front controller to invoke the front controller in the public folder. Make sure you add the .htaccess to that document root prohibiting all sensitive data from being accessed.

1 Comment

I added index.php to root folder with content require ('public/index.php'), but images and other assets are not loaded. I think I need extra .htaccess rewrite rules for it.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.