How can i change http://domain.com/public/index.php to http://domain.com and can get the other routes working other than ('/')
?
Workaround 1:
vhost file:
<VirtualHost *:80>
DocumentRoot "/var/www/html/domain/public"
ServerName domain.com
<Directory "/var/www/html/domain/public">
AllowOverride All
Allow from All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
htaccess file:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
With this setup, yes i'm able to set http://domain.com but when i'm trying to invoke another route, getting a 404. The reason behind this is as you can see i've set my root folder as public. So my routes cannot reach their destinations (like the ones which are being directed to my controllers, because my controllers are not in the public folder).
Workaround 2:
If i change Document root and directory into /var/www/html/domain/
this time i'm losing my pretty url and only way i can request main page by entering http://domain.com/public/index.php
.
Note that I'm using ubuntu 14.04.
What do you suggest?
---update---
Route example:
Route::get('myroute', array(
'uses' => 'MyController@myMethod',
'as' => 'myroute'
));
---update 2--- php artisan route:list results are
+--------+----------+---------+------+---------+------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+---------+------+---------+------------+
| | GET|HEAD | / | | Closure | web |
| | GET|HEAD | myroute | | Closure | web |
+--------+----------+---------+------+---------+------------+