2015-03-07 2 views
0

Я хочу удалить index.php в URL-адрес сайта laravel 4.2. Но я не знаю, как это сделать. Без index.php/страницы не загружаются. Мой routes.php содержитКак удалить index.php из URL-адреса в laravel 4

Route::get('/', '[email protected]'); 

Route::get('login','[email protected]'); 

Route::get('forgotpassword', '[email protected]'); 

Route::post('loginprocess', '[email protected]'); 

Route::group(array('before' => 'auth'), function() 
{ 
Route::get('locations','[email protected]'); 
Route::get('createlocation','[email protected]'); 
Route::post('createlocation','[email protected]'); 
Route::get('editlocation/{data}','[email protected]'); 
Route::post('editlocation/{data}','[email protected]'); 
Route::get('deletlocation/{data}','[email protected]'); 

Route::post('statusactiveLocation/{data}','[email protected]'); 
Route::post('statusinactiveLocation/{data}','[email protected]'); 

Route::get('vendors','[email protected]'); 
Route::get('createvendor','[email protected]'); 
Route::post('createvendor','[email protected]'); 
Route::get('editvendor/{data}','[email protected]'); 
Route::post('editvendor/{data}','[email protected]'); 
Route::get('deletevendor/{data}','[email protected]'); 

Route::post('statusactiveVendor/{data}','[email protected]statusactiveVendor'); 
Route::post('statusinactiveVendor/{data}','[email protected]'); 

Route::get('logout', '[email protected]'); 
}); 
+0

Какой HTTP-сервер вы используете Apache, nginx и т. Д.? Вам необходимо настроить веб-сервер, чтобы разрешить переписывание URL. Вы это сделали? – Bogdan

+0

Не могли бы вы показать свои маршруты? – sisve

+0

Это не работает для меня – Sujitha

ответ

0

Попробуйте это ...

To remove the “index.php” suffix from the end of your Laravel applications url, use one of the two methods below. 

This also works for removing the public from your url 

method1.

At the minimum use the following code and put it in your “public” folder inside an htaccess file. Make the public folder the root of your application. 

Options -MultiViews 
    RewriteEngine On 

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

Method2.

If you do not have access to change you application’s root folder to public, put the following code in your application’s root directory(which presumably is the one where public is contained in) inside of a .htaccess file. 

Options -MultiViews 
    RewriteEngine On 

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