Jump to content

can PHP read fragments (after hashmark #anchor) from URL?


micah1701

Recommended Posts

if the url is my-domain.com/some_page#here_is_an_anchor is there anyway to read that anchor value server side?

parse_url() shows that it can parse the value, but the examples for that function are setting the value of the URL as a string, hard-coded into the script.  I need to detect the URL dynamically.

 

My suspicion is that this is impossible but I figured it can't hurt to ask.  Thanks for any advice.

thanks for your input. Seems to firm up what I'm coming to realize, its just not possible.

 

I have an ajax based page that loads content with javascript and simultaneously appends the url with a /#!/shebang tag to keep it SEO friendly with google.  The only problem is, if JS isn't enabled, obviously the content can't load. I wish I could still use the anchor tag urls AND preload the content.  Oh well.  Guess its back to old fashioned ?variables=in_the_url  :(

what you're describing isn't an anchor, it is actually part of the url and can be grabbed. for instance, twitter picks up stuff after /#!/ in

 

http://twitter.com/#!/SalonsOnline

 

you can use mod_rewrite and/or PHP to redirect or passthrough based on whatever is after #!

what you're describing isn't an anchor, it is actually part of the url and can be grabbed. for instance, twitter picks up stuff after /#!/ in

 

http://twitter.com/#!/SalonsOnline

 

you can use mod_rewrite and/or PHP to redirect or passthrough based on whatever is after #!

 

well perfect. thats my question, how can php (or htaccess) get that value?

 

i did a print_r($_SERVER) and don't see #! anywhere in there.  Where can I get the value of the URL to parse server-side?

 

EDIT:  turn off javascript and try that link to twitter again. It doesn't redirect. They're using javascript to detect the hashbang in the URL and redirect the browser.  Seems to indicate that this is still impossible  :(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.