我正在开发laravel的网站,但工作正常,但我的网址中存在小问题
我的网址工作正常
http://localhost:8080/JobScholar/contact
http://localhost:8080/JobScholar/index
但是当我在网址末尾使用/
时
http://localhost:8080/JobScholar/contact/
http://localhost:8080/JobScholar/index/
将我重定向到
http://localhost:8080/index
http://localhost:8080/contact
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.26 (Win32) OpenSSL/1.0.2l PHP/7.1.7
的.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
Options -Indexes
ErrorDocument 403 http://localhost:8080/JobScholar/index
Options +FollowSymLinks
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
路由
Route::get('/contact', 'ContactPageController@index');
Route::get('/index', 'HomePageController@index');
答案 0 :(得分:0)
尝试在RewriteBase /JobScholar/
RewriteEngine On
答案 1 :(得分:0)
我不确定,但我认为您需要在.htaccess
来自
RewriteRule ^(.*)/$ /$1 [L,R=301]
要
RewriteRule ^(.*)/$ /JobScholar/$1 [L,R=301]