Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Practical Q: Searchfriendly urls / PHP/MYSQL

Status
Not open for further replies.

Olavxxx

Programmer
Sep 21, 2004
1,134
NO
Hi,

What I am wondering about, is actually practical.
I already have working code for making "fake" urls..

eg.: is actually: :// (fake is a file with no extension).

Anyways, My question is as follows:
I am to run queries, based on two integers, as the content is generated dynamically.

The reason I need "fake urls"; like above, is that google, amongst others, will not crawl all your pages, if they are all /index.php?id=foo

This is due to the fact, that they are afraid to get into an infinite loop.. (or so I've read).

I first made the script parse id and subcat as usual, at the end of the "fake url", like:

Then, my brain worked.. If I use those ?id=13&subcat=1, it will not work, as then again, google will not crawl the querystring.. (unless I mis-understood something here).

eg. the page would not work without the ?id=13&subcat=1, that would result in every page beein "home", (default).

So, My question is: How do I "hide" the integers I use for queries?

I've thought of two ideas:

To make this short, lets say CID = COntent Id, and PID = Page ID.
Version one: Version two:
Which is better of the two?

The last version, I thought I could explode the array contents on the "_", to get the integer and then run a query.

If I am to use the first example, I dont really know how I should extract the integers, as not all pages have subpages...

My cms has only two levels: Mother and Child, and they are both in the same table.

I guess, maybe I could also do:

/mother/child/mother_id/child_id/
then I could do a count() on the array and check how many elements. Then I would know if elements > 2, the page has a sub-page (child).


Olav Alexander Mjelde
Admin & Webmaster
 
I'm not sure your information on how google spiders is correct.

For example, google
php tek-tips file manipulation

And the first hit has


I think the issue that people confuse is that it's not going to fill out forms, or value javascript onclicks or alot of the those type of things which people use to create the links on the fly, but it will follow your links even if they contain parameters.

-Rob
(not 100% on this one, so please, correct me if I'm wrong)
 
Oh... and to answer the direct question... here's how I would do it.


Then split up the URL at params, and pair up the name/value pairs from everything to the right of it... or you could use something like the p_ as a search and not care where it shows up in the URL.
 
have you considered mod_rewrite? I don't know much about it, but it seems that this is what you're looking for...

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top