我有一个问题。我有一个VPS与Debian 11和Webmin,我想托管我的Laravel项目,但我需要重定向所有的请求到public/index.php
文件,但...我的.htaccess没有工作。
我的.htaccess文件
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php [L,QSA]
</IfModule>
我也试过
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php [L,QSA]
我的域.conf文件
<VirtualHost *:80>
ServerAdmin admin@api.domain.pl
ServerName api.domain.pl
ServerAlias www.api.domain.pl
DocumentRoot /var/www/api.domain.pl/public_html
<Directory /var/www/api.domain.pl/public_html>
Options Indexes FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.api.domain.pl [OR]
RewriteCond %{SERVER_NAME} =api.domain.pl
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
我的apache2.conf文件
<Directory /var/www>
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory
我已经使用命令
a2enmod rewrite
service apache2 restart
service apache2 --full-restart
我看到
Apache2版本:2.4.54 PHP版本:8.1.8
1条答案
按热度按时间ocebsuys1#
你确定抓到他了吗
检查是否正确:
"用sudo激活他"
然后重新启动apache2