Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Starting point site

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #37058
    downbylaw
    Member

    I lately started doing some OOP programming. In my site root I want to create a directory ‘public’ where all the public content will go. Directories like ‘css’ ‘includes’ will go on the same level as ‘public’.

    1. I don’t want to display the whole path (mysite.com/public/..) to my visitors but I want to set ‘public’ as a starting point when visitors type the url into their browser… Your host needs to support this option on their servers; does anyone know any hosts? How is this ‘option’ called by programmers?

    2. Can I manage to do this with .htaccess?

    Thanks!

    #98563
    karlpcrowley
    Participant

    Sounds like you’re trying to build an MVC framework
    Here’s some tutorials to help you understand
    (part 1 of 5)
    http://www.youtube.com/watch?feature=player_embedded&v=Aw28-krO7ZM

    Basically in the root of your site you would have index.php doing all of the work

    Once you get the hang of it I recommend taking a look at CodeIgniter too
    http://codeigniter.com/

    #98566
    Krist
    Member

    root
    —public/


    index.php


    css/


    style.css

    CASE
    ‘public’ folder as default controller.
    You just call yours.com to view public/index.php

    CODE [htaccess]


    RewriteEngine on

    # Change yours.com to be your primary domain
    RewriteCond %{HTTP_HOST} ^(www.)?yours.com$

    RewriteCond %{REQUEST_URI} !^/public/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /public/$1

    # Change yours.com to be your primary domain
    RewriteCond %{HTTP_HOST} ^(www.)?yours.com$

    RewriteRule ^(/)?$ public/index.php [L]
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.