all the pages are parsed through index pages but if the pages is parsed through the index page then PHP codes are not parsed. And in the page source code all the php code are showing. I have use the .htaccess file and the code is given below:
# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.org [NC]
RewriteRule ^(.*)$ http://www.domain.org/$1 [R=301,NC]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ /index.php/$1 [R,L]
Order allow,deny
Allow from all
<Files 403.shtml>
order allow,deny
allow from all
</Files>
Getting all the file contents from the function in the index page. The function is:
public function getPageContent()
{
$html = implode('', file($this->_ROOT.$this->getPage()));
echo $html;
}
Whats happening is that you just request the content of the file.
file()
get you everything what is inside of that file, it gives it back in plain text. You should need to include the requested page in your index.php, for example:
The request: home.php -> index.php?p=home.php
.htaccess
RewriteRule ^(.*)$ /index.php?p=$1 [R,L]
index.php
<?php
/* Do some checks to secure the input. */
include($_GET['p']);
?>