From: Ahmed Mohsen on
Hi folks,
I know that this is not a php question, but I'm sure it some kind
related to it. I need to put my public files under "public" folder, and
other includes files and database config in other folder not shown to
the public, but i don't know how to do that. I hope if some one show me
how to achieve this.

For example, this is the directory structure:

/root
--/includes
----db.php
----config.php

--/public
----/index.php
----/images
----/admin
------/login.php



I don't want to enter (example.com/public) to view index.php file. I
just want to enter (example.com) and it redirects to the public folder
and shows only (example.com/index.php) in the URL. And for login.php
should display (example.com/admin/login.php) not
(example.com/public/admin/login.php)

Kind regards,
Ahmed.
From: "Daniel P. Brown" on
On Thu, Jun 10, 2010 at 14:06, Ahmed Mohsen <mrez05(a)gmail.com> wrote:
[snip!]
>
> I don't want to enter (example.com/public) to view index.php file.  I just
> want to enter (example.com) and it redirects to the public folder and shows
> only (example.com/index.php) in the URL.  And for login.php should display
> (example.com/admin/login.php) not (example.com/public/admin/login.php)

That's an HTTP server configuration. For example, with Apache,
you should look at the DocumentRoot setting.

--
</Daniel P. Brown>
daniel.brown(a)parasane.net || danbrown(a)php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!
From: Ashley Sheridan on
On Thu, 2010-06-10 at 21:06 +0300, Ahmed Mohsen wrote:

> Hi folks,
> I know that this is not a php question, but I'm sure it some kind
> related to it. I need to put my public files under "public" folder, and
> other includes files and database config in other folder not shown to
> the public, but i don't know how to do that. I hope if some one show me
> how to achieve this.
>
> For example, this is the directory structure:
>
> /root
> --/includes
> ----db.php
> ----config.php
>
> --/public
> ----/index.php
> ----/images
> ----/admin
> ------/login.php
>
>
>
> I don't want to enter (example.com/public) to view index.php file. I
> just want to enter (example.com) and it redirects to the public folder
> and shows only (example.com/index.php) in the URL. And for login.php
> should display (example.com/admin/login.php) not
> (example.com/public/admin/login.php)
>
> Kind regards,
> Ahmed.
>


If /public is your web root, then alter your virtual hosts file to
reflect this, so that it is the one that is used as the web root.

If /public is not your web root, then you could consider using
mod_rewrite() to internally redirect the content the visitors see,
without them actually knowing about it.

Thanks,
Ash
http://www.ashleysheridan.co.uk


From: Ahmed Mohsen on
Thanks for help.
 | 
Pages: 1
Prev: Question - foreach.
Next: bug in mkdir?