Forum Moderators: phranque

Message Too Old, No Replies

redirect url that contains hash #

redirect url that contains hash #

         

ittemple

2:07 am on Feb 24, 2012 (gmt 0)

10+ Year Member



hi guys,
I have been looking for some time to find how to redirect a dynamic url that has a hash to another url for example
Redirect www.mydomain.com/main.php#/our-work/avatar-flash
to www.mydomain.com/avatar-flash
i undertand that apache will escape the "#" char but i need to find a work around. Any help is appreciated.

lucy24

3:31 am on Feb 24, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Can't be done, unless Apache 2.4 has added something. The hash mark # is a fragment identifier that isn't "seen" by the server. It's only used by the browser. You can do a Forums search for the word "fragment" and see what comes up.

I used this wording

fragment site:webmasterworld.com/apache

to eliminate the 1000+ other threads that mention fragments.

Now, if you're asking about referers that include the hash, as in google's "jump to" links, that's a whole nother question.

g1smd

7:46 am on Feb 24, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Does the site use Ajax at all?

penders

10:13 am on Feb 24, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Can't be done, unless Apache 2.4 has added something.


Irrespective of the server software, the browser should not include the fragment identifier as part of the request, so it never even gets to the server.

IMO, if you want to redirect to another page based on the fragment identifier then you will need to do this in the browser (with JavaScript).

...if you're asking about referers that include the hash, as in google's "jump to" links, that's a whole nother question.


Not wanting to go off on too much of a tangent, but... what's that then?

ittemple

6:33 pm on Feb 24, 2012 (gmt 0)

10+ Year Member



Does the site use Ajax at all?
Yes it does.

At this point i have to find a way to do it ajax, php. Anyone has any ideas?

g1smd

7:09 pm on Feb 24, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If that's an Ajax URL use
#!
instead of
#
in the URL.

ittemple

7:27 pm on Feb 24, 2012 (gmt 0)

10+ Year Member



use #! in the url redirect in .httaccess file ?

lucy24

10:29 pm on Feb 24, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



...if you're asking about referers that include the hash, as in google's "jump to" links, that's a whole nother question.
Not wanting to go off on too much of a tangent, but... what's that then?

There are a couple of threads. In this forum [webmasterworld.com].

This may be the earliest discussion [webmasterworld.com].

Oh, and here's one about fragments and ajax [webmasterworld.com] that may be relevant. ("May be" means I don't speak ajax so I can't say for sure ;))