在PHP中使用端口号和根文件夹重写URL
我写过这样的URL重写在PHP中使用端口号和根文件夹重写URL,php,linux,.htaccess,mod-rewrite,xampp,Php,Linux,.htaccess,Mod Rewrite,Xampp,我写过这样的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-releas
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=$1
RewriteRule ^single_pr/([0-9]+)$ single_pr.php?id=$1
在将其转换为webconfig后,它在IIS服务器上运行良好
但是当我在XAMPP Linux上部署我的应用程序时,它不工作,也不显示,
在浏览器上重定向循环
有谁能告诉我如何在URL重写中添加端口号和文件夹名,因为我认为IIS将localhost/myapplication视为localhost/index.php,这就是它在IIS中工作的原因。
Linux和Windows指南。我找到了解决方案,问题与Linux操作系统中apache中禁用的mod_重写功能有关。 要了解mod_rewrite已启用或禁用。 只需运行
php\u info()
并搜索mod\u rewrite
。这是一种简单的技术,有多种方法可以找到mod_重写。
要启用
mod_rewrite
,请转到您的linux终端并键入此命令a2enmod rewrite
,然后重新启动apachephp_info()
您想实现什么?请给出重写前后的URL示例。我没有试图实现任何东西,我已经实现了,我只是想问为什么上面的代码不适用于apache linux和windows。但我们不知道代码应该做什么。。。给我们举一个预期结果的例子。