[英]Apache2 Module Rewrite it is not working as it should
我在 PHP 中创建了一个 MVC 系统,并使用 Apache 重写模块来保护一些文件夹并编写 URL。
我在使用 Xampp 的开发机器上创建了基础,我什至在在线服务器(客户端)上使用了相同的系统,一切正常。
但是我想在我工作的公司中设置的服务器上拥有相同的 MVC 系统,供其他开发人员使用,但该服务器无法正常工作。
On the server giving this problem, I have installed Ubuntu 20.04 (Desktop), Apache 2, PHP 7.4.13 and MySQL. 我已经启用了重写模块。
我正在使用相同的 .htaccess,我在我的机器(Windows)和在线服务器(公共网络服务器)Linux 上都使用它。
在我正在使用的 .htaccess 文件下方
我用来始终将客户端重定向到公用文件夹的第一个 .htaccess 文件
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
这第二个在公用文件夹内,用于编写 URL
<IfModule mod_rewrite.c>
Options -Multiviews
RewriteEngine On
RewriteBase /criate/public
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>
后者位于 App 文件夹内,我使用它们无法访问该文件夹
Options -Indexes
我的 Apache default.conf 文件
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow, deny
allow from all
Require all granted
</Directory>
但是发生了什么,当访问项目 url 时,我们假设它是: https://api.aplication.com
效果很好,带我到应用程序之家。 但是,例如,当我单击登录按钮时。 给我以下错误。
未找到 在此服务器上未找到请求 URL
但是有,因为我制作了一个在 Windows 和在线服务器 Linux 上运行的项目的副本。
我必须查看和分析什么配置才能解决此问题?
在 phpinfo 中,它说明了哪个模块处于活动状态。 谢谢
我已经发现我在 .htaccess 文件中做错了什么,按照我在所有 .htaccess 文件中所做的更改。
RewriteEngine On
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
Options -Multiviews
RewriteEngine On
RewriteBase /criate/public
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
它只是删除了检查模块是否处于活动状态的条件,我将进一步研究以了解如何在 LINUX 中执行这些条件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.