Ask a Question related to PHP Development, Design and Development.
-
Purple Haze #1
Virtual Directories?
I have seen websites that use a sort of "virtual directory" system...
Lets say when you click on something it goes to
[url]http://www.example.com/scripts/php/[/url]
Neither the scripts directory nor the php directory physically exisit on
the server, does anyone know how this is done?
Purple Haze Guest
-
https and virtual directories
I've never done a login to a website so please bear with me. What is the best way to go about this? Do I put all of the pages in a subdirectory... -
No JRunScripts virtual directories (?)
The CF7 document 'Configuring Web Servers' says that I should have a virtual directory called JRunScripts in each of my IIS websites. I upgraded... -
nested virtual directories
I am using the Fiefdom techniques ( a seperation of concerns pattern ). I have 2 asp.nET projects, each with their own virtual dir 1.... -
virtual directories and IIS
I created a new directory on my hard drive C:\test. I mapped a virtual directory called MyWeb to this directory. Now when I try to create an... -
Using virtual directories for common directories (scripts, images, styles, etc.)
Hi, (sorry for the crosspost, I wasn't sure which was the best place to put this). I was just thinking about something and wondered if any of... -
Thomas Mlynarczyk #2
Re: Virtual Directories?
Also sprach Purple Haze:
The Apache web server can automatically transform a path into another using> I have seen websites that use a sort of "virtual directory" system...
>
> Lets say when you click on something it goes to
> [url]http://www.example.com/scripts/php/[/url]
>
> Neither the scripts directory nor the php directory physically exisit
> on the server, does anyone know how this is done?
the Alias directive in its configuration files:
Alias /scripts/php c:/just/another/directory
So, when you type [url]http://www.example.com/scripts/php/[/url], Apache goes to
c:/just/another/directory instead.
However, there is a much more flexible solution with Apache, it's called
mod_rewrite. This is an Apache module that allows you to transform
(re-write) URLs whichever way you wish, depending on the URL and the
environment. Example:
RewriteEngine On
RewriteRule ^scripts/php/(.*)$ /my/own/directory/myscript.php?page=$1
So, when you type [url]http://www.example.com/scripts/php/welcome.html[/url], the above
rule (to be placed either in the Apache's config file or an .htaccess file)
will transform this into
[url]http://www.example.com/my/own/directory/myscript.php?page=welcome.html[/url]. The
syntax of mod_rewrite uses regular expressions and is a bit complicated (I'm
not even sure if my above example will actually work, but it illustrates the
principle.) But it can be a very powerful tool.
Greetings,
Thomas
Thomas Mlynarczyk Guest
-
Shawn Wilson #3
Re: Virtual Directories?
Purple Haze wrote:
Hey,>
> I have seen websites that use a sort of "virtual directory" system...
>
> Lets say when you click on something it goes to
> [url]http://www.example.com/scripts/php/[/url]
>
> Neither the scripts directory nor the php directory physically exisit on
> the server, does anyone know how this is done?
[url]http://www.example.com/scripts/php/[/url]
1. Create a file called "scripts" in the web root.
2. Make a .htaccess file to force Apache to interpret "scripts" as PHP
<Files scripts>
ForceType application/x-httpd-php (going from memory. Google "ForceType")
</Files>
3. Manually get the trailing bits and use them to search a database or whatever.
$possiblevalues = array('php', 'cgi', 'perl', 'asp');
$trailingbits = preg_replace('/^scripts\//', '', $_SERVER['REQUEST_URI']);
if (!in_array($trailingbits, $possiblevalues))
show_my_error('Invalid script type');
else
list_scripts($trailingbits);
Shawn
--
Shawn Wilson
[email]shawn@glassgiant.com[/email]
[url]http://www.glassgiant.com[/url]
Shawn Wilson Guest
-
Berislav Lopac #4
Re: Virtual Directories?
On Mon, 27 Sep 2004 22:35:08 GMT, Purple Haze wrote:
a) mod_rewrite on Apache> I have seen websites that use a sort of "virtual directory" system...
>
> Lets say when you click on something it goes to
> [url]http://www.example.com/scripts/php/[/url]
>
> Neither the scripts directory nor the php directory physically exisit on
> the server, does anyone know how this is done?
b) custom 404 error page
Berislav Lopac Guest
-
Justin Koivisto #5
Re: Virtual Directories?
Berislav Lopac wrote:
c) ISAPI_rewrite on IIS> On Mon, 27 Sep 2004 22:35:08 GMT, Purple Haze wrote:
>
>>>>I have seen websites that use a sort of "virtual directory" system...
>>
>>Lets say when you click on something it goes to
>>[url]http://www.example.com/scripts/php/[/url]
>>
>>Neither the scripts directory nor the php directory physically exisit on
>>the server, does anyone know how this is done?
>
> a) mod_rewrite on Apache
> b) custom 404 error page
--
Justin Koivisto - [email]spam@koivi.com[/email]
[url]http://www.koivi.com[/url]
Justin Koivisto Guest



Reply With Quote

