【发布时间】:2011-03-23 09:29:07
【问题描述】:
我对此处的 url 方向有疑问。我在 apache 中使用 mod_rewrite 将 url 从 domain.com/page.php 重写为 domain.com/path/page.php。
我在网页中有一些链接,例如href="newpage.php" 将自动转到 domain.com/path/newpage.php 而不是 domain.com/newpage.php。我可以知道是否有任何 php 方法可以在 php 文件本身中设置所有默认 url 以避免此路径问题?不使用任何变量,如href="<?php echo $_SERVER['domain']; ?>newpage.php"
【问题讨论】:
-
相对 URL 由客户端解析,而不是由服务器解析。
标签: php url mod-rewrite apache2