2014-01-12 120 views
0

我一直在寻找最近45分钟的类似问题,所以如果这个问题已经被询问,请与我袒护。RewriteRule - 链接问题

我有这样的重写规则:

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^(.*)$ $1.php [NC] 
RewriteRule ^user/(.*)$ user.php?user=$1 [NC,L]  

这给出了一个很好的网址:中

localhost/user/myname 

代替:

localhost/user.php?user=myname 

一切正常,只是当我点击此页面标题中的徽标

<div class="logo"> 
    <a href="index.php"><h2>Mylogo</h2></a> 
</div> 

重新加载在同一页(user.php的)这个网址:

http://localhost/user/index.php 
+0

我可能误解了,但user.php与链接怎么样? – NewInTheBusiness

+0

它重新加载user.php而不是index.php当我点击链接 – mat

回答

1

的斜线将带你回到根文件夹。

<div class="logo"> 
    <a href="/"><h2>Mylogo</h2></a> 
</div> 
+0

我试过了,我得到http:// localhost/user/index代替。 – mat

+0

你想要链接带你去哪里? – NewInTheBusiness

+0

回到localhost – mat