PHP URL HASH

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Cyote101
Forum Newbie
Posts: 1
Joined: Sun Oct 17, 2010 3:39 pm

PHP URL HASH

Post 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.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: PHP URL HASH

Post 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.
Post Reply