2

My project is currently accessible like that:

website.com/development/views/index.php

My question is should I use URL rewriting to hide /development and /views and put index.php in the main /public_html folder or get rid of the /development folder? The issue with that is there are a bunch files from my hosting provider in public_html, so I wouldn't want to mix it with my application.

bbking7
  • 85
  • 1
  • 8

1 Answers1

1

Whilst it is a matter of preference, the standard practice in most php applications, I have seen is to have the index.php file in the root folder.

Instead of this

website.com/development/views/index.php

Most developers would expect something like this

website.com/development/index.php

Folder structure:

development
        |
         ---views
         ---js
         --- css
         --- index.php 

The index.php file should sit at the same level as your views folder.

ArrowHead
  • 609
  • 5
  • 16
  • Thank you. How can it be organised so that when users type website.com, they will automatically see the index.php, which is inside development, i.e. how to make /development the root folder, rather than /public_html which is by default? – bbking7 Feb 04 '16 at 10:17
  • In that case you need to set up virtual hosting, take a look at this if you're using apache server https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts – ArrowHead Feb 04 '16 at 10:25
  • I've already set up a shared GoDaddy hosting account.. it would really be an overkill for that situation... So, in case I don't do virtual hosting, it would be best to just put all my App files in the public html ? – bbking7 Feb 04 '16 at 10:34
  • 1
    You can read on Symbolic Links. I have no experience with GoDaddy. – ArrowHead Feb 04 '16 at 14:01
  • Ok, for anyone interested, the solution is very simple. What I did is first removed /development, and second created an index.php file that sits in the root public_html folder and redirects to my views/index.php – bbking7 Feb 04 '16 at 15:43