Jump to content


Photo

Virtual directories


  • Please log in to reply
2 replies to this topic

#1 Horst Azeglio

Horst Azeglio
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 13 July 2006 - 10:56 PM

Is it possible in PHP to create "virtual directories" (like in wikipedia)?
for instance http://en.wikipedia....i/Wayne_Gretzky
There's no Wayne_Gretsky directory

another good example of what I'm looking for is this forum itself!
each topic is a "virtual" html file. How do you do that?

Thank you

#2 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 13 July 2006 - 11:05 PM

Well the most common thing to do is to use apache mod_rewrite and a set of rewriting rules to rewrite the URL to a backend page.

However, if you want the simple way you can do this trick:
URL in browser is: www.site.com/index.php/Directory/NoExist
Now, index.php will run fine and $_SERVER['PATH_INFO'] will be something like this:
/Directory/NoExist
By parsing this you can easily to a pseudo -rewrite without extra modules.
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#3 Horst Azeglio

Horst Azeglio
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 13 July 2006 - 11:07 PM

sounds good, I'll do that right now. thanks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users