如何更改链接中的网址(<a> tag)?

时间:2015-08-02 04:49:34

标签: php .htaccess hyperlink url-rewriting

I have a web directory localhost/web/folder1/folder2/ When I make a link <a href="login.php"> in the folder2, then the result is localhost/web/folder1/folder2/login.php

How rewrite display name of folder2 localhost/web/folder1/folder2/login.php to localhost/web/folder1/new_folder2/login.php without canged <a href="login.php"> ?

1 个答案:

答案 0 :(得分:1)

我不确定我是否理解您的问题,但您是否尝试使用<a href="../new_folder2/login.php">之类的内容?您可能根本不需要触摸.htaccess,只需使用../在相对目录路径上向上一级。

如果您特别想要.htaccess来处理这个问题,请查看this post如何重写文件夹名称。