Home  |  Linux  | Mysql  | PHP  | XML
From:Michael A. Peters Date:Thu Jul  2 17:26:02 2009
Subject:Re: generally, where in cPanel can one set the default page to
load?
Govinda wrote:
> Dear list-members
> 
> I am using what I assume is a pretty standard cPanel setup (?)
> 
> I would like to be able change the mime types/extension so that ".html" 
> gets sent through the PHP interpreter, but I see the cPanel docs say 
> "...(note that you can not alter the system defined mime type values)..".
> 
> So as a workaround, I need to *at least* be able to change the default 
> file to return to the browser when someone hits my domain (or a 
> subdirectory) without specifying the page in that dir/ to load.
> I cannot find where in cPanel to set that.  The default now is the 
> standard "index.html".    I want to change it to "index.php".
> I realize this is really basic stuff, but I can't find it in my cPanel.
> 
> Can someone point me to this?
> 
> -Govinda
> 

If you have mod_rewrite installed - put the following in your .htaccess 
file:


RewriteEngine on

RewriteRule ^index\.html$ index.php [L]

That will cause index.php to be called when index.html is requested.
If you want it to forward to index.php then use [R] instead of [L]

If you want all .html to be sent to php equivalents -

RewriteRule (^.*)\.html$ $1.php [L]

should do the trick.

btw - with those rules, the .html files do not need to exist. If/when 
they are requested, whether they exist or not, the link or redirect is made.

mod_rewrite rocks

Navigate in group php.general at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by Zareef Ahmed
Powered By PHP Consultants