开发者

jQuery - Address plugin problem

I've come across a problem which i cant seem to figure out, i use the jQuery address plugin to store history and enable deep linking, and a typical url after a click would look like this:

http://mysite.com/#!/page

Problem here is i need rid of the last / so i need it to look like this:

http://mysite.com/#!page

I'm using plugin version 1.2 - the latest is 1.4. When i use 1.4 my hashbang #! disappears.. Anyone know why? even so, the updated version produces the same problem.

Reasons to fix this are i use 301 redirects to 'Pretty URL's' if an ?_escaped_fragment_= is requested. So this:

http://mysite.com/data/#!page1

would become:

http://mysite.com/data/page1

currently it does this: mysite.com/data//page1

here is the .htaccess rewrite:

<IfModule mod_rewrite.c>
  RewriteEngine on

  # Rewrite current-style URLs of the form 'index.php?url=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]
</IfModule>
开发者_运维技巧

and here is some relevant PHP i use on page load:

if ($fragment = $_GET['_escaped_fragment_']) {
    // OPTION 1: if Google is reqesting an '_escaped_fragment_=' page, then redirect to a clean URL
    header("Location: $base/$fragment", 1, 301);
    exit;
}

Any help on how to make this situation better is appreciated.. I don't want 'use the HTML5 History API' as ive explored this option already.


This line of code can help!

$.address.strict(false);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜