URL 在 PHP 中用端口号和根文件夹重写
URL Rewriting with port number and root folder in PHP
我已经写了URL重写成这样
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^home index.php
RewriteRule ^process login_do.php
RewriteRule ^logout logout.php
RewriteRule ^request event-request.php
RewriteRule ^gallery event-gallery.php
RewriteRule ^press-releases/([0-9]+)$ press_releases.php?y=
RewriteRule ^single_pr/([0-9]+)$ single_pr.php?id=
将其转换为 webconfig 后,它在 IIS 服务器上运行良好
但是当我在 XAMPP Linux 上部署我的应用程序时,它无法正常工作并显示,
在浏览器上重定向循环。
任何人都可以指导我如何在 URL 重写中添加端口号和文件夹名称,因为我认为 IIS 正在将 localhost/myapplicaiton 视为 localhost/index.php 所以这就是它在 IIS 中工作的原因。
指导我 Linux 和 Windows。
我找到了解决方案,问题与 mod_rewrite 功能在 linux 操作系统中的 apache 中被禁用有关。
找出 mod_rewrite 是启用还是禁用。
只需 运行 php_info()
并搜索 mod_rewrite
。这是一项简单的技术,有多种方法可以找出 mod_rewrite。
要启用 mod_rewrite
,请转到您的 linux 终端并键入此命令 a2enmod rewrite
并重新启动 apache php_info()
。
我已经写了URL重写成这样
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^home index.php
RewriteRule ^process login_do.php
RewriteRule ^logout logout.php
RewriteRule ^request event-request.php
RewriteRule ^gallery event-gallery.php
RewriteRule ^press-releases/([0-9]+)$ press_releases.php?y=
RewriteRule ^single_pr/([0-9]+)$ single_pr.php?id=
将其转换为 webconfig 后,它在 IIS 服务器上运行良好 但是当我在 XAMPP Linux 上部署我的应用程序时,它无法正常工作并显示, 在浏览器上重定向循环。
任何人都可以指导我如何在 URL 重写中添加端口号和文件夹名称,因为我认为 IIS 正在将 localhost/myapplicaiton 视为 localhost/index.php 所以这就是它在 IIS 中工作的原因。 指导我 Linux 和 Windows。
我找到了解决方案,问题与 mod_rewrite 功能在 linux 操作系统中的 apache 中被禁用有关。
找出 mod_rewrite 是启用还是禁用。
只需 运行 php_info()
并搜索 mod_rewrite
。这是一项简单的技术,有多种方法可以找出 mod_rewrite。
要启用 mod_rewrite
,请转到您的 linux 终端并键入此命令 a2enmod rewrite
并重新启动 apache php_info()
。