Php 如何在apache中为应用程序url添加前缀?
我的项目是在Symfony1.4框架(PHP)中完成的。它已在我的计算机上配置,我可以按以下方式访问应用程序 我所有的网址都像 xhttpx://localhost:8082/login xhttpx://localhost:8082/logout xhttpx://localhost:8082/new/item xhttpx://localhost:8082/item/edit/id/34 等等 现在我想将我的所有URL更改为 xhttpx://localhost:8082/pink/login xhttpx://localhost:8082/pink/logout xhttpx://localhost:8082/pink/new/item xhttpx://localhost:8082/pink/item/edit/id/34 等等 i、 e.在基本url后附加粉红色(http://localhost:8087) 我希望在不修改Symfony 1.4文件(例如routing.yml等)的情况下实现这一点 我想我们可以通过修改httpd.conf和编写适当的重写规则来实现这一点 注意:请将xhttpx理解为http,因为stackoverflow不允许我发布超链接。Php 如何在apache中为应用程序url添加前缀?,php,apache,mod-rewrite,url-rewriting,symfony-1.4,Php,Apache,Mod Rewrite,Url Rewriting,Symfony 1.4,我的项目是在Symfony1.4框架(PHP)中完成的。它已在我的计算机上配置,我可以按以下方式访问应用程序 我所有的网址都像 xhttpx://localhost:8082/login xhttpx://localhost:8082/logout xhttpx://localhost:8082/new/item xhttpx://localhost:8082/item/edit/id/34 等等 现在我想将我的所有URL更改为 xhttpx://localhost:8082/pink/logi
请提供帮助。在根目录中创建一个.htaccess文件,其中包含以下内容:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://localhost:8082/pink/$1 [R=301,L]
这告诉Apache将.htaccess所在文件夹中的所有流量路由到/pink/ 这将导致“此网页具有重定向循环”。这可能是在域localhost内重定向的结果。我知道,当你从一个域重定向到另一个域时,这是可行的(因此,当你发布你的项目时,它可能会起作用)。在此期间,我将寻找一个替代方案。