View Full Version : set .php as default?
RevKev
05-18-2001, 04:58 AM
I no longer have any .html files on my site. Everything is .php. What I want is for people who type in something like: .com/email for it to take them to .com/email.php rather than say it can't find the file.
It should do that!!!!
If you had an index.php it would go to that
you could set up an .htaccess file to acomplish what you want
Just put a line in an .htaccess file that resides in a particular folder like this
DirectoryIndex email.php
RevKev
05-18-2001, 04:32 PM
the index.php file does come up if you just type in a folder path (i.e. .com/ or.com/phpbb/ ). What it won't do is go to the right page if I just type in: .com/index . It has to be .com/index.php.
Dallagnol
05-19-2001, 11:57 AM
Pardon me if I am mistaken, but I do believe the server will automatically look for index.php, but NOT for other .php files, such as email.php. That's why it's not working in your site.
The solution in this case would be as DCE suggested, to add
DirectoryIndex email.php
to the .htaccess file.
Or have one index.php in each directory. I use the .htaccess solution on my website.
Cheers,
Paulo R. Dallagnol
http://www.pinkfloydfan.net
petesmc
05-19-2001, 12:23 PM
Actually, I understand what you are trying to do, however I doubt you can actually do what you are trying to accomplish.
Personally, I never type: domain.com/index I always add the extensions and I'm sure most other people do.
Your best try would to be in the .htaccess at a Redirect from index to index.php and etc.
Good Luck
-Peter
glennb
05-22-2001, 08:39 AM
If you only type .com/index the server assumes that "index" is a folder & not a file!
the htaccess solution works I use it myself ...
Glenn
DarkWizard
05-23-2001, 10:41 PM
Go to your control panel and then to the "Apache Handlers" and add the following:
.php application/x-httpd-php
If you want to go to a specific page other than index.whatever then create an htaccess file and plce the following into it:
DirectoryIndex email.php
RevKev
05-23-2001, 11:04 PM
Thank you to all for answering my question. Unfortunately, I don't think I asked the question very well. I think Pete understood what I was doing, and his answer is kind of what I was expecting. I don't want to change the default page for the site, index.php works just fine. It was more a matter of wondering if there is any way to change the default web page extension from .html to .php, which I'm guessing is more a matter of the browser than the server.
So, thank you for trying!
Nope, that's a server issue.
Actually, that's the way it works for me(host4.hrwebservices.net).
If there's no index.html it looks for index.php.
You could use .htaccess for this.
Just put
DirectoryIndex index.php
or
DirectoryIndex index.php index.html
if you want to looks for index.html if there's no index.php.
If you put this in a .htaccess-file in your document root(/home/whatever/public_html) it will affect all your subdirectories.
Hope this helped
Regards
/Adam
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.