Reputation: 388
I created my app on Homestead. Everything works fine there. But when I moved app to an external server I always have to include index.php after root path.
Example:
www.domain.com/index.php/contact
How to I get rid of index.php to make my URL prettier?
Application is located:
/var/www/
Public directory is renamed to html:
/var/www/html
PS. I'm using apache2.
Upvotes: 1
Views: 77
Reputation: 8128
Assuming you already point your web server to public directory, your problem should be in your Apache conf.
Laravel comes out with .htaccess
in public/.htaccess
but you need to enable the mod rewrite in Apache for it to work
sudo a2enmod rewrite
For the .htaccess
to work, you need to set the AllowOveride
directive in Apache conf
<Directory "/var/www/public">
AllowOverride All
</Directory>
Upvotes: 1
Reputation: 163928
You should point Apache to a public
directory which is inside Laravel directory. Restart Apache and you will be able to use normal URLs like www.domain.com/contact
You should use something like this when creating a virtual host:
DocumentRoot "/var/www/public"
<Directory "/var/www/public">
Upvotes: 0