I know this isn't a php question directly (well it might just be) but I have virtual directories set up that need to have spaces... how can this be handled? with %20? or special characters?? %20 doesn't seem to work though with apache. I know you can have unix directories with spaces or even windows... But can you have virtual directories with spaces Thanks for your help,
Jeff
Apache and spaces for vitual directories
Moderator: General Moderators
What do you mean with a "virtual directory" ?
On most operating systems it's a matter of using " " to place the name.
If you want to provide a hyperlink to a name.. You need to look at
http://www.php.net/urlencode.
On most operating systems it's a matter of using " " to place the name.
Code: Select all
mkdir "e;/home/timvw/My Documents"e;
deltree "e;F:/Documents And Settings/timvw/My Documents"e;http://www.php.net/urlencode.
Virtual Directories: normally means the use of the Apache ForceType directive to allow one "root" script to handle a collection of pages, with some of the parameters masquerading as directories. As an example from my site, the URL
the script is actually "details" in the results directory. All of the later "directories" are virtual -- "2642","Newcomer","Standard","YCN Points" and are parsed into parameters for the queries/display.
Details is not a ".php" simply "details"
the results directory has an .htaccess file with
and Apache automagically back chains to try to find a matching script.
Regarding the OP question about spaces, as the example above shows the space is encoded as %20. So far, I've had success with using the space as a spance and the browser/php has always auto-converted for me. I know I need to look into it more to know why, but....
Code: Select all
http://localhost/~nielsene/cib/main-dev/results/details/2642/Newcomer/Standard/YCN%20PointsDetails is not a ".php" simply "details"
the results directory has an .htaccess file with
Code: Select all
<Files details>
ForceType application/x-httpd-php
</Files>Regarding the OP question about spaces, as the example above shows the space is encoded as %20. So far, I've had success with using the space as a spance and the browser/php has always auto-converted for me. I know I need to look into it more to know why, but....
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
I'm guessing you're using IIS since this uses the term "Virtual Directories" to mean the same thing Apache does by "Aliases"...
In Apache's httpd.conf you need to add a line:
In IIS (using the snap-in) you simply right click over the directory (or website) and choose "Make Virtual Directory" -> The wizard will talk you through the rest.
OK now to parse .html as PHP... you need to add a handler for this type of file in httpd.conf...
In IIS you need to do the same thing but I dont remember where it is in the snap-in control.
Either way... then answer to your question is yes... if the path contians spaces you will have to use it's URL encoded format to view it in a web browser. http://www.yourdomain.com/aliased%20path/
I think that's what you were referring to right?
Note: PHP will ignore such directives... you'll have to use absolute real paths in any code you write
In Apache's httpd.conf you need to add a line:
Code: Select all
Alias /aliased-path/ /actual-path/
#or if it contains spaces
Alias "e;/aliased path/"e; "e;/actual path/"e;OK now to parse .html as PHP... you need to add a handler for this type of file in httpd.conf...
Code: Select all
AddHandler php-script .php .htmlEither way... then answer to your question is yes... if the path contians spaces you will have to use it's URL encoded format to view it in a web browser. http://www.yourdomain.com/aliased%20path/
I think that's what you were referring to right?
Note: PHP will ignore such directives... you'll have to use absolute real paths in any code you write
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia