mardi 30 avril 2019

htaccess rewrite url to always have a default tag like this for every route: www.xyz.com/"~khane2"/

I'm trying to set up my laravel project made on a local appache server on a internal hosting service of my university.

The problem I am having is that except for the routes related to my laravel projects Authorisation/Authentication (HomeController) stuff other routes do not work as this prefix header should always be in the link for every route but the header is not added for the rest of the routes. See bolded part of this link, I need this "/~khane2/" for every page in my website.:

https://www.cs2410-web02pvm.aston.ac.uk/~khane2/home

Here is my web.php of my laravel project:

Route::get('/animal_user_change_status/{animal_id}/attach', 'Animal_usersController@attach');
Route::get('/animal_user_change_status/{animal_id}/{user_id}/detach', 'Animal_usersController@detach');
Route::get('/animal_user_change_status/{animal_id}/{user_id}/Accept', 'Animal_usersController@setAcceptToStatusColumn');
Route::get('/animal_user_change_status/{animal_id}/{user_id}/Reject', 'Animal_usersController@setRejectToStatusColumn');
Route::get('/viewuserdata', 'Animal_usersController@viewUserData');
Route::get('/viewanimalsdata', 'Animal_usersController@viewAnimalData');

Route::get('/', 'AnimalController@index'); // just incase anything redricts to '/'
Route::resource('Animal', 'AnimalController');
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');

Here is my .../public_html/.htaccess from my server (I copied and pasted this code into .htaccess given by my university professor, but this is not working for all routes, I need it to work for all routes that are shown in the web.php above.):

    <IfModule mod_rewrite.c>
 <IfModule mod_negotiation.c>
 Options -MultiViews -Indexes
 </IfModule>
 Options +FollowSymLinks
 RewriteEngine On
 # Handle Authorization Header
 RewriteCond %{HTTP:Authorization} .
 RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
 #Redirect Trailing Slashes If Not A Folder...
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_URI} (.+)/$
 RewriteRule ^ %1 [L,R=301]
 #Handle Front Controller...
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_URI} /(~[^/]+)(.*)
 RewriteRule ^ /%1/index.php [L]
</IfModule>

Thanks in advance



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2Lg7Jen
via IFTTT

Aucun commentaire:

Enregistrer un commentaire