homepage Welcome to WebmasterWorld Guest from 23.22.173.58
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
[PHP] How does the webserver know the directory?
GrodanBoll

10+ Year Member



 
Msg#: 397 posted 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:
[xxx.com...]
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 :)

 

gethan

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 397 posted 3:15 pm on Mar 12, 2002 (gmt 0)

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.

GrodanBoll

10+ Year Member



 
Msg#: 397 posted 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 :)

gethan

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 397 posted 10:42 am on Mar 15, 2002 (gmt 0)

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

GrodanBoll

10+ Year Member



 
Msg#: 397 posted 10:45 am on Mar 15, 2002 (gmt 0)

:)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved