Mod 重写页面锚点
过去两个小时我一直在努力解决这个问题。我已经尝试过谷歌上提到的所有解决方案,但没有任何运气。
让我们从问题开始。我正在尝试使用这个插件: http://www .gethifi.com/blog/a-jquery-plugin-to-create-an-interactive-filterable-portfolio-like-ours
在我的网站上。问题是这个插件正在使用锚标记。没有它,它似乎不起作用。 好吧,我正在尝试在我现在正在开发的网站上使用用户友好的 URL。所以锚点不起作用。
这是我现在的 .htaccess 文件:
RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*)\.html$ /mysite/category.php?cat=$1 [L]
RewriteRule ^([^/]*)/([^/]*)\.html$ /mysite/category.php?cat=$1&lang=$2 [L]
没什么花哨的,只是对类别和语言进行了一些重写。唯一有效的似乎是:
RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*)\.html$ /mysite/category.php?cat=$1 [L]
RewriteRule ^([^/]*)/([^/]*)\.html$ /mysite/category.php?cat=$1&lang=$2 [NE,R,L]
但是当我使用它时,我的用户友好 URL 也消失了。相反,我看到:category.php?cat=....
我不知道这是否重要,但我使用
指向我所在的主机正在努力。
预先感谢您的任何想法。
I've been trying to solve this for the past two hours. I already tried every solution mentioned on google, but without any luck.
Let's start with the problem. I'm trying to use this plugin:
http://www.gethifi.com/blog/a-jquery-plugin-to-create-an-interactive-filterable-portfolio-like-ours
on my website. The problem is that this plugin is using Anchor tags. Without it, it doesn't seem to work.
Well, I'm trying to work with User Friendly URL's on the website I'm working on right now. So the anchors are not working.
This is my .htaccess file right now:
RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*)\.html$ /mysite/category.php?cat=$1 [L]
RewriteRule ^([^/]*)/([^/]*)\.html$ /mysite/category.php?cat=$1&lang=$2 [L]
Nothing fancy, just some rewrites for categories and languages. The only thing that seems to work is this:
RewriteEngine On
RewriteBase /
RewriteRule ^([^/]*)\.html$ /mysite/category.php?cat=$1 [L]
RewriteRule ^([^/]*)/([^/]*)\.html$ /mysite/category.php?cat=$1&lang=$2 [NE,R,L]
But my User Friendly URL is also gone when I use this. Instead I see: category.php?cat=....
I don't know if this is important but I use <base href="">
to point to the host I'm working on.
Thanks in advance for any ideas.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Anchor
#
是一个 URL 片段,apache 会忽略并且不支持重写。使用客户端方法是唯一的解决方法。
或者您可以尝试 PHP parse_url - PHP_URL_FRAGMENT
Anchor
#
is an URL fragment, apache will ignore and not cater for rewrite.Using client approach is the only workaround.
Or you can try PHP parse_url - PHP_URL_FRAGMENT
找不到让插件与mod_rewrite结合使用的方法,所以我就放弃了,使用了另一个插件。它似乎可以找到,因为它不需要锚点来工作。
和平。
编辑:
这是我现在使用的代码:
我刚刚将其从列表更改为 div。
Couldn't find a way to make the plug-in work in combination with mod_rewrite, so I just gave up and used another plug-in. It seems to work find, since it doesn't need an anchor to work with.
Peace.
Edit:
This is the code I'm using right now:
I just changed it from list to divs.