My own php CMS: setting up a folder structure similar to wordpress and hiding it to the public

admin

Administrator
Staff member
I can still be considered 'new' to web development and server-side programming especially. I thought building myself a nice, clean and easy to expand CMS would help me improving my skills and my overall comprehension.

At my first try I didnt really gave a thought on how to structure the CMS and just started coding my desired functionality. But then I came to the point where I started wondering if the way I am doing this, is really the way to go. I felt like my backend was too strongly tied together with the 'public visible' website itself (a website for a friendly photographer btw). I started looking around, how other cms' are doing this and decided I will try to build my structure similar to the one of <b>wordpress</b>.

So far I setup the following folder structure (which is pretty much the same in wordpress only with other directory names):

<ul>
<li>CMS
<ul>
<li>admin - <em>where the websites maintenance is done</em></li>
<li>includes - <em>the core classes/functions for the cms</em></li>
<li>public - <em>the public part of the website, similar to a wordpress theme</em></li>
</ul></li>
</ul>

My domain, e.g. myurl.com is pointing to the root-folder 'CMS'.

Ok so far so simple. But now I am stuck. If I - as an anonymous visitor - want to get to the public part of the website, I need to call something like:
Code:
www.myurl.com/public/whatever.php

But I - as a website administrator - don't want anyone to be able to see the structure of my site. They should just need to call
Code:
myurl.com
and should be automatically redirected to the public folder of my cms. My first thought was, well then I just need to let myurl.com point to the public folder of my cms. But with that solution, how am I - as an administrator - going to reach the admin folder? I would have to setup a new subdomain e.g. admin.myurl.com and let it point to the admin folder.

But... thats not what wordpress is doing. For a wordpress blog the url just needs to point to the root folder and the admin panel can be reached through somewpblog.com/wp-admin

<ol>
<li>can anyone explain to me how this stuff is working in wordpress and what I need to do to achieve this effect for my cms?</li>
<li>how can I hide the filename from the url like its done in wordpress, e.g. instead of
Code:
somewpblog.com/category.php?id=123
->
Code:
somewpblog.com/?cat=123
</li>
</ol>