我设置了一个本地Laravel服务器进行开发,并通过Git将更改推送到我的生产服务器。Laravel auth not working将mysite.com/index.php改为mysite.com
我做了一个新的Laravel项目,我没事。然后我在本地服务器上添加了php artisan make:auth,并将其推送到生产环境,但404无法找到登录名(或注册表)。经过一番努力,我发现: www.mySite.com/login 无法找到,但如果我写 www.mySite.com/index.php/login它的作品。
所以,现在我想我必须修改我的htaccess忽略index.php,但我无法得到它的工作。我试了一些建议,但似乎没有工作,我不知道为什么它不工作。
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase Test/public/
* RewriteCond %{THE_REQUEST} /index\.php [NC]
* RewriteRule ^(.*?)index\.php$ /$1 [L,R=302, NC, NE]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^(.*)/$ /$1 [L,R=301]
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>
标有*的两行在尝试在Stack Overflow上阅读此建议后添加(现在无法找到链接)。我也试过 htaccess remove index.php from url 这个建议。
任何想法?谢谢。 编辑: 我启用的站点 -/000-default.conf看起来是这样的:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/Test/public
<Directory /var/www/html/Test/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =nfoscan.com
RewriteRule^https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
和我的000默认-LE-ssl.conf中是这样的:
<IfModule mod_ssl.c>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
ServerAdmin [email protected]
DocumentRoot /var/www/html/Test/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/letsencrypt/live/mysite.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mysite.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ServerName mysite.com
</VirtualHost>
</IfModule>
我删除了在CONFIGS评论..
我尝试添加
<Directory /var/www/html/Test/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
我000违约乐-ssl.conf但它导致内部服务器错误..
嗨,即时通讯非常新的Apache和Apache配置..我编辑我的问题与Apache配置文件..我认为问题是000-default-le-ssl .conf但我不知道如何改变它使其工作(请参阅我的编辑)。 /谢谢:) – hybris
你有htaccess的: 'SSLEngine的on' 您也可以在Apache日志搜索错误: '/无功/日志/的Apache2/error_log' – Rafael
在我的000默认-LE-SSL。 conf我可以将DocumentRoot设置为/ var/www/html或/ var/www/html/Test/public,并且两者都可以正常工作......但是当我混淆了时,只有 工作正常 给内部服务器错误? –
hybris