html - Why do some websites not show a .php at the end of their file extension? -
this question has answer here:
- remove .php extension php 4 answers
sometimes when @ websites url this
www.website.com/index.php
and other times this
www.website.com/index/
why second url not have .php or .html extension?
in configured web server,
www.website.com/index.php
tells load index.php file webroot directory. this
www.website.com/index/
tells in /index/ directory file matching listed in directoryindex configuration directive in server's httpd.conf file or in .htaccess file in web site's webroot directory (see http://httpd.apache.org/docs/2.2/mod/mod_dir.html#directoryindex details).
a sample configuration directive this:
directoryindex index.php index.html default.html default.htm
this tell web server to, when no filename given, in current directory index.php file, if not found index.html file, , if not found default.html file , on else on line.
if want able run php files without having have .php on end of them, set default handler in configuration files (httpd.conf or .htaccess) such as:
forcetype application/x-httpd-php
this tell apache handle files php whether have .php extension or not. (see http://httpd.apache.org/docs/2.2/mod/core.html#forcetype )
you can use modrewrite remap urls if prefer, modrewrite directives can confusing , difficult troubleshoot.
Comments
Post a Comment