Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

[PHP] How does the webserver know the directory?



2:51 pm on Mar 12, 2002 (gmt 0)

Hi again, I keep stumble into trouble today. :(

I'm making a redirectpage for my place on the web.

It contains of a .htaccess-file

ErrorDocument 404 /processor2.php

So when people are trying to access a file that doesn't exist the will be redirected to processor2.php.
In the processor2.php i take the url apart and then include a file depending on the url.
For example:
Then, when I take the url apart, I'll get one variables: game = 'cs' . I can the include the file gamestory.php and it will get the variables.

All this to get nice search-engine friendly pages.

It works fine until I get an '/' after the first variable (in this case 'cs'), then the server or PHP (?) are trying to access the file gamestory.php from the directory /cs/, which don't exist.
How can I get the server to collect the files from the main directory? Are there any header I can pass?

/grodan :)


3:15 pm on Mar 12, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Try include_once('/gamestory.php'); (or require etc).

Also take a look at mod_rewrite ... does all the things your doing in php, and lots more, definitely worth learning about.


7:03 am on Mar 15, 2002 (gmt 0)

I solved this by using '.' instead of '/'. Like: www.example.com/dep1.news.12.html

/Grodan :)


10:42 am on Mar 15, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Grodan - I misunderstood your question first time round ... glad you fixed it.


10:45 am on Mar 15, 2002 (gmt 0)


Featured Threads

Hot Threads This Week

Hot Threads This Month