Mod重写页面锚 [英] Mod rewrite page anchor

查看:78
本文介绍了Mod重写页面锚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去两个小时,我一直在努力解决这个问题.我已经尝试过Google提到的所有解决方案,但没有任何运气.

I've been trying to solve this for the past two hours. I already tried every solution mentioned on google, but without any luck.

让我们从问题开始.我正在尝试使用此插件: http://www .gethifi.com/blog/a-jquery-plugin-to-create-an-interactive-filterable-portfolio-like-ours

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

在我的网站上.问题在于该插件正在使用Anchor标签.没有它,它似乎不起作用. 好吧,我正在尝试使用我现在正在使用的网站上的用户友好URL.因此锚点无法正常工作.

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.

这是我现在的.htaccess文件:

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]

但是,当我使用它时,我的用户友好URL也消失了.相反,我看到了:category.php?cat = ....

But my User Friendly URL is also gone when I use this. Instead I see: category.php?cat=....

我不知道这是否重要,但是我使用<base href="">指向我正在处理的主机.

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.

推荐答案

无法找到使该插件与mod_rewrite结合使用的方法,所以我只是放弃并使用了另一个插件.似乎可以找到工作,因为它不需要锚来工作.

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.

和平.

这是我现在正在使用的代码:

This is the code I'm using right now:

        $(document).ready(function() {

            $('.menu li a').click(function() {


                $('.menu li').removeClass('selected');
                $(this).parent('li').addClass('selected');

                thisItem    = $(this).attr('rel');

                if(thisItem != "all") {

                    $('.item li[rel='+thisItem+']').stop()
                                                            .animate({'width' : '110px', 
                                                                         'opacity' : 1, 
                                                                         'marginRight' : '.5em', 
                                                                         'marginLeft' : '.5em'
                                                                        });

                    $('.item li[rel!='+thisItem+']').stop()
                                                            .animate({'width' : 0, 
                                                                         'opacity' : 0,
                                                                         'marginRight' : 0, 
                                                                         'marginLeft' : 0
                                                                        });
                } else {

                    $('.item li').stop()
                                    .animate({'opacity' : 1, 
                                                 'width' : '110px', 
                                                 'marginRight' : '.5em', 
                                                 'marginLeft' : '.5em'
                                                });
                }
            })

            $('.item li img').animate({'opacity' : 0.5}).hover(function() {
                $(this).animate({'opacity' : 1});
            }, function() {
                $(this).animate({'opacity' : 0.5});
            });

        });

我只是将其从列表更改为divs.

I just changed it from list to divs.

这篇关于Mod重写页面锚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆