Click to See Complete Forum and Search --> : Directory content managment


Gustavs
07-10-2006, 09:58 AM
Hey, I'm new to PHP and I'm working on a web page that needs to have a content system that works like this "www.domain.com/home/" instead of "www.domain.com/index.php?id=home"

I know how to set up that ID content system, but I don't know how to do the other one.

How could I do that?

The Little Guy
07-10-2006, 10:02 AM
just make a directory, put your files in there, then link to the file.

www.domain.com/home/
aka
www.domain.com/home/index.php

Gustavs
07-10-2006, 10:04 AM
just make a directory, put your files in there, then link to the file.

www.domain.com/home/
aka
www.domain.com/home/index.php


Well, yeah, I know, but I want it to be more automatic, so I don't have to update all the subdirectories, but just one file - that would be header.php or any else.

See my point?

The Little Guy
07-10-2006, 10:09 AM
This will make a directory

<?php
$some_folder_name = cat;

mkdir("$some_folder_name", 0700);

$ourFileName = "$some_folder_name/index.php";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);
?>

Gustavs
07-10-2006, 10:12 AM
This will make a directory

$some_folder_name = $from_above

mkdir("/path/to/directory/$some_folder_name", 0700);


Well, uhm, thats still not what I need. I want to know the technique how to make such engine dynamic.

NogDog
07-10-2006, 10:36 AM
If on Apache you could do what I think you are asking via ModRewrite commands in .htaccess - but I'm not sure exactly what you want to do. (And frankly I always wonder if such contrivances are really necessary if a web site is well thought-out and organized?)

sitehatchery
07-10-2006, 01:15 PM
I have the same issue. I have page and category ID's in the query string which corespond with page and category ID's in the database. Dynamic pages such as this are not search engine friendly. So, one supposed way around this is to make it look like you are accessing a static page in a directory by converting the query string in the address bar from ww.domain.com/index.php?id=home to ww.domain.com/home where "home" represents any masked name that you relate to the page ID. I want to do this as well and am looking for a good resource to show me how.

The host is using IIS

NogDog
07-10-2006, 02:49 PM
Dynamic pages such as this are not search engine friendly.
Does anyone have any evidence that this is true (not including hearsay evidence probably promulgated by "SEO specialists" trying to create work for themselves)? I mean, I find links in Google searches all the time to topics in this forum as well as others, all using URL query strings.

Maybe this was a problem in 1996, but I really find it very hard to believe that any major search engine cannot deal with URL query strings, which have been part of the HTML standard pretty much forever (in internet time).

sitehatchery
07-10-2006, 03:03 PM
Yeah, http://www.google.com/support/webmasters/bin/answer.py?answer=35769.

Under Design and Content Guidlines:

If you decide to use dynamic pages (i.e., the URL contains a "?" character), be aware that not every search engine spider crawls dynamic pages as well as static pages. It helps to keep the parameters short and the number of them few.

In addition, under Technical Guidlines:
Don't use "&id=" as a parameter in your URLs, as we don't include these pages in our index.

NogDog
07-10-2006, 03:32 PM
So: keep the query strings reasonably short and don't use "id" as a query parameter name, and you should be OK with Google.

Sorry to side-track the thread a bit, Gustavs, I just wanted to undertand the problem (or lack thereof) a little better.

sitehatchery
07-10-2006, 03:38 PM
To cover all the basis with search engines, and to better ensure friendly search engine crawling in the future, I'd still like to know how to do it.

NogDog
07-10-2006, 03:47 PM
Afraid I've never worked in IIS, so I don't know if there's a corollary to Apaches's ModRewrite function. :(

NogDog
07-10-2006, 05:26 PM
Hmmm... I had an idea for using a custom 404 page to parse the refering link and redirect to the desired page?query, but then I realized it wouldn't work if the user got there via a bookmark or directly typing the link in the address bar. :(

Gustavs
07-11-2006, 04:37 AM
Found a solution (http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html#introduction)

sitehatchery
07-11-2006, 09:01 AM
Wow! Thanks for posting that. I'll take a look a little later today.