General discussion

Locked

Virtual Pages / Scripts as Directories

By techsup ·
I recently began supporting a new site that uses virtual pages - or more appropriately - php scripts in the directory structure. When trying to convert the site to another server these pages/scripts do not work.
example
http://www.myserver.com/animals/mammals/dog
A mammals file exists at http://www.myserver.com/animals/
with the following code:
<?php

require_once($_SERVER['DOCUMENT_ROOT'] . '/_includes/config.php');
list($a, $cat_id) = explode("/", $_SERVER['PATH_INFO']);
if($cat_id=='' || !is_numeric($cat_id)){
echo "Invalid or no parameter supplied";
exit();
}
if(!Biology::validCategoryID($cat_id)){
echo "Invalid category supplied";
exit();
}

Does a redirect or dns alias need to be setup for the mammals file to work properly? Is this an "approved" method of displaying virtual pages?

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by techsup In reply to Virtual Pages / Scripts a ...

The url would actually be .../mammals/72
which would display the Dog Category.

The script continues after to retrieve the data from the Database and display the webpage.
However, I can only get it to work when I have .../mammals.php/72 in the url instead of just .../mammals/72

Thanks for the help.

Collapse -

by Jaqui In reply to Virtual Pages / Scripts a ...

is the server set to allow the url aliasing?

and shouldn't it be $DOCUMENT_ROOT?

but the $_SERVER and the doc root shouldn't need to be specified.
you should be able to get the include with:

<?php

require_once "/includes/config.php"

the _ in the path may also cause an issue, depending on server config.

Collapse -

by techsup In reply to

After further research, this is just an alternate method of processing Search Engine friendly URL's(url aliasing). You are correct on Document_Root as well.
Thanks

Collapse -

by techsup In reply to Virtual Pages / Scripts a ...

This question was closed by the author

Back to Web Development Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums