Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess问题与href_.htaccess_Redirect - Fatal编程技术网

.htaccess问题与href

.htaccess问题与href,.htaccess,redirect,.htaccess,Redirect,我已经在我的网站上工作,同时想开发.htaccess文件 Options +SymLinksIfOwnerMatch RewriteEngine On # Turn on the rewriting engine RewriteRule ^home?$ index.php [NC,L] RewriteRule ^hk/restaurants?$ all_rest.php?loc=hk [NC,L,QSA] RewriteRule ^kw/rest

我已经在我的网站上工作,同时想开发.htaccess文件

Options +SymLinksIfOwnerMatch
RewriteEngine On    # Turn on the rewriting engine
RewriteRule    ^home?$    index.php    [NC,L]

RewriteRule    ^hk/restaurants?$    all_rest.php?loc=hk    [NC,L,QSA]
RewriteRule    ^kw/restaurants?$    all_rest.php?loc=kw    [NC,L,QSA]
当我的url显示www.mywebsite.com/hk/restaurants时,浏览器会显示正确的文件

我目前只有这个,正在工作,但现在我添加了一个带引导的选项卡系统:

<ul class="nav nav-tabs">
  <li class="active"><a href="#"><h1 class="title2">Restaurants</h1></a></li>
  <li><a href="#"><h1 class="title2">Cuisines</h1></a></li>
</ul>
正如您所看到的,当我单击url更改为www.mysite.com/时,标记a带有一个href,我再次被重定向到索引

有什么想法吗?

只要在href中有一个链接,它就永远不会自己导航。后跟一些字符将导致浏览器尝试将具有该名称/id的元素移动到页面顶部。如果前面没有显示任何内容,它将在当前页面上显示


问题可能出在您正在使用的选项卡系统的底层javascript上。虽然.htaccess没有问题,但很可能是配置问题。

问题在于所有页面标题上的基本元素:S当我使用它时重定向到我的根文件夹。我猜这也是可能的。不管是什么情况,javascript并没有像它应该的那样取消导航。应在单击处理程序触发后立即调用event.preventDefault。