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

pakuize's avatar

htaccess help

Hi there been using laravel 4 on shared hosting with great success with a htaccess tweak only, been trying to update to laravel 5 to get a feel for all the changes. I just seem to have a problem it will not remove /public from the url no matter what I do to the htaccess file. it looks like this so far.

Options -MultiViews

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

right now it's as it comes with laravel the document root is is a folder out from public so the htaccess file have been moved out and updated with public folder as you can see, it works with laravel 4 but not with 5 anyone have eny thoughts on this.

0 likes
10 replies
bart's avatar

Did you try to remove the rewriting? Your virtual host root has to point to the public directory. Is that possible at your shared hoster?

pakuize's avatar

Unfortunately on this one host I do not have the ability to change document root as it is shared hosting.

bashy's avatar

I've setup one on shared hosting with a symlink to another folder. If you don't have SSH access ask your host if they can set that up for you. If they can't, move host.

You should never be able to browse to the public folder and you shouldn't rewrite it in htaccess

bashy's avatar

^ Works but can be messy if you have multiple sites. Although sub domains can be created in a sub directly.

abhimanyusharma003's avatar

^ On shared hosting if you are using multiple domain or sub-domain then magically you get the ability to change to document root via their add-on/sub domain manger

But yes this is a total mess.

This is why we don't go with shared hosting any more, cloudhosting are as low as $10/month no idea why people ignore such a great service.

pakuize's avatar

Thanks for all the insight it's been nice to see so much feedback, I think I will move this last site to another host. Anyone know of a good cloudhost?

pakuize's avatar

Thanks for the list will check them out.

bashy's avatar

They're all just hosts without a control panel to manage domains (FTP/Email etc) All depends how well you know Linux commands.

If you want something like Plesk or cPanel included, you could look at something like this: http://www.ovh.co.uk/vps/vps-cloud.xml then add Plesk (free for 10 domains) or cPanel which is like £8/m

Please or to participate in this conversation.