[英]able to access only the / route in Laravel 5.2
I am able to access only the '/' route and all my other routes are returning 404. 我只能访问“ /”路由,而所有其他路由都返回404。
I have installed laravel on a new EC2 instance and I have ensured that my php, Mysql and apache2 are all running 我已经在新的EC2实例上安装了laravel,并确保我的php,Mysql和apache2都在运行
My Laravel version is 5.2.45 我的Laravel版本是5.2.45
my 000-default.conf is as follows 我的000-default.conf如下
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/testing/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
my apache2.conf file is as follows 我的apache2.conf文件如下
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/html/testing/public>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
my folder structure is /var/www/html/testing 我的文件夹结构是/ var / www / html / testing
But I am getting a 500 when trying to hit the ip..Any help will be highly appreciated. 但是当我尝试达到ip时我得到500。任何帮助将不胜感激。
routes.php routes.php
**********Physiotherapist******/
Route::get('/home-request/physiotherapist', 'HomeController@physiotherapist');
Route::post('/physiotherapist', 'ServicesController@requestPhysio');
Route::post('/physiotherapist/getPhysioRates', 'ServicesController@getPhysioRates');
/********** Doctor *************/
Route::get('/home-request/doctor', 'HomeController@doctor');
Route::post('/doctor', 'ServicesController@requestDoctor');
Route::post('/doctor/getDoctorRates', 'ServicesController@getDoctorRates');
/********** Patient Attendant *************/
Route::get('/home-request/patient-attendant', 'HomeController@patient');
Route::post('/patient', 'ServicesController@requestAttendant');
Route::post('/patient/getPatientAttendantRates', 'ServicesController@getPatientAttendantRates');
/public/.htaccess file /public/.htaccess文件
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
Options -Indexes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
# RewriteRule ^([^\.]+)/([^\.]+)$ /$2.php [L]
# 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>
<ifmodule mod_expires.c>
ExpiresActive On
AddType image/x-icon .ico
ExpiresByType image/gif "access plus 60 days"
ExpiresByType image/jpeg "access plus 60 days"
ExpiresByType image/png "access plus 60 days"
ExpiresByType image/ico "access plus 60 days"
ExpiresByType image/x-icon "access plus 60 days"
ExpiresByType text/css "access plus 60 days"
ExpiresByType application/javascript "access plus 60 days"
ExpiresByType application/x-javascript "access plus 60 days"
ExpiresByType text/javascript "access plus 60 days"
ExpiresByType application/json "access plus 7 minutes"
</ifmodule>
## EXPIRES CACHING ##
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
Header append Vary User-Agent
</IfModule>
You need to allow override in Your appache conf. 您需要在您的appache conf中允许覆盖。 Try this:
尝试这个:
<Directory /var/www/html/testing/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.