apache - apache2 httpd configuration -


my document root /var/www , have no virtual hosts enabled. folder structure of /var/www:

index.php classes (external) controllers models files (img, js, css) views (pages, components) 

as can see using model view controller pattern. need correct configuration have use in httpd.conf define files folder can accesed , no other folder, prevent "not found" messages or direct php access. how can set up?

this current httpd.conf

serversignature off servertokens full  # settings server @ port 80. <virtualhost *:80>     servername <url>     documentroot /var/www     directoryindex index.php      # no 1 has access main directory.     <directory />         order deny,allow         deny         options none         allowoverride none     </directory>      # configure main directory     <directory /var/www>          # has access main directory.         order allow,deny         allow         options followsymlinks         allowoverride none          # enable clean urls.         rewriteengine on         rewritecond %{request_filename} !-f         rewritecond %{request_filename} !-d         rewriterule ^(.*)$ index.php/$1 [l]     </directory> </virtualhost> 

thanks :)

if possible, ideal keep controllers, view scripts , other application related code out of /var/www , instead put in /var/application or that.

then don't need rewrite rules deny access files. if ever wanted add access new folder (e.g. /var/www/css) have make accessible. or have reverse situation explicitly deny folders don't want accessed. works if .htaccess ever broken or forgets rules moving new server have more work do.

in index.php, define constant tells files live (e.g. define('application_path', '/var/application');


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -