htaccess如何始终为每个路由在URL中包含子域

时间:2019-04-30 16:23:46

标签: .htaccess laravel-5 server

我正在尝试在大学内部共享托管服务的本地appache服务器上建立我的laravel项目。

我遇到的问题是,除了与我的laravel项目相关的路由(授权/身份验证(HomeController))之外,其他路由均不起作用,因为这些路由的子域不会像这样自动为其添加(粗体部分是子域):

  

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

这是我的laravel项目的web.php:

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');

这是我从服务器上访问的... / public_html / .htaccess。

    <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>

预先感谢

0 个答案:

没有答案