Modify href -or- URL Redirect / Rewrite and pattern matching using javascript or jquery -


im struggling figure out best way redirect/rewrite urls pattern matching using javascript.

background:

i have blog filtered tag: http://adrtimesv6.squarespace.com/library/?tag=the+psychology+%26+neuroscience+of+mediation (select view visitor if comes up)

i have area in site called "collections" load in groups of posts library in own real page other content in more controlled environment page titles , urls better seo, this: http://adrtimesv6.squarespace.com/collections/the-psychology-and-neuroscience-of-mediation. posts loaded in via query pulls in posts library have tag matches name of collection page. working pretty well. problem im running when filters blog posts tag want them redirected collection page rather go blog filter page.

question:

what im trying figure out how use jquery redirect /library/?tag=[path] urls /collection/[path] urls. think need use jquery to:

1) swap "/libary/?tag=" "/collections/"

2) revise rest of path tag formatted path "the+psychology+%26+neuroscience+of+mediation" collection formatted path: "the-psychology-and-neuroscience-of-mediation"

additional information:

i using cms dont have access things .htaccess file. in cms admin settings there url redirect panel allows me list basic redirects in format: -> ... trying tag filter urls not working.

im concerned redirect occuring when user clicks on tags listed @ bottom of blog post - use jquery modify href attribute in tag listed blog post. not sure how write pattern matching , rewrite format correctly. ive tried bunch of things cant seem it.

or perhaps use window.location.replace somehow?

update: in particular case, found update template code , json formatters tag link href generated matches url in collection section - problem solved ....however, still wonder how handle other situations.

basically, 1) how use javascript or jquery check if url (either href on page or browser url) contains something, replace else, , modify full url simple dashed url .... takes out + signs , replaces them - , removes %26 & characters return simple url string, etc, like: /here-is-the-path

on single page, can use forward visitor new page:

window.location = "http://www.google.com" 

you add logic use same script on every page. example:

if ( document.location == "http://adrtimesv6.squarespace.com/library/?tag=the+psychology+%26+neuroscience+of+mediation" ) {   window.location = "http://adrtimesv6.squarespace.com/collections/the-psychology-and-neuroscience-of-mediation" } 

and on. add more advance string manipulation handle every url.

but doing javascript redirect in manner not have positive seo effects such friendly urls. not enable web server handle new url; if http://adrtimesv6.squarespace.com/collections/the-psychology-and-neuroscience-of-mediation returns error web server, no amount of front end javascript able fix that.

doing javascript negative experience users, because first have download page first url, then execute javascript, , download page new url.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -