Page 1 of 1

PHP URL HASH

Posted: Sun Oct 17, 2010 4:07 pm
by Cyote101
Hi all,
New to the forum, and new to php. Hope everyone had a good weekend.

I'm looking into the php switch function, and i was wondering if anyone out there knows how to do the following.

My page has 20 or so links, and it uses java script to perform hash changes and browser history. The javascript i'm ussing produces urls like this "http://www.website.com/store/#!/shop/cart.php". Basically for this url there was a link on the index page of and that link read "/shop/cart.php" and it was loaded with ajax, so there was no page refresh. It's a fully functioning URL. If you pasted it in a browser you would land on the right page, but only if you had java script enabled.

So what I'm trying to play with is a php version of this that when a page with that type of url is requested, the php page redirects and loads the desired link. all these urls would be reachable from the main index page, that is there is a link to all pages from there.

so my question is, How do you make comparisons of the requested url and the links that exist in the html of a page, and then when a match is found redirect to that page.

I hope that makes sense, Thanks for all your help on this folks.

Re: PHP URL HASH

Posted: Sun Oct 17, 2010 6:09 pm
by Jonah Bron
To my knowledge, the hash and anything past it is not given to the server. If that is true, there is no way for PHP to detect that. What I would do is to default to a non-hash version, and put in a Javascript redirect to the Javascript; that way they only get there if they have Javascript enabled.