Default PHP Sites | Unix Linux Forums | Web Programming

  Go Back    


Web Programming Discuss Web Programming and Web Server Administration, including LAMP, Apache, MySQL, HTML, SEO, and other Web APIs and topics.

Default PHP Sites

Web Programming


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-04-2013
FreddoT FreddoT is offline
Registered User
 
Join Date: May 2013
Last Activity: 23 August 2014, 3:52 AM EDT
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Wrench Default PHP Sites

Hi,

I am aware that you can use a DirectoryIndex directive to ensure that the default page is "index.php" or something similar, but my situation is slightly different.

Essentially (I'm sure there must be some obvious solution), I want to be able to write code like:
Code:
<a href="define">Define Page</a>

rather than like
Code:
<a href="define.php">Define Page</a>

.

Is there no way I can have apache detect .php files as well as .html automatically?

ATM I just get
Code:
The requested URL /define was not found on this server.

Sponsored Links
    #2  
Old 07-04-2013
Corona688 Corona688 is online now Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 27 November 2014, 3:14 PM EST
Location: Saskatchewan
Posts: 19,943
Thanks: 848
Thanked 3,420 Times in 3,205 Posts
What if there really is a file named 'index'? What if there's a directory named 'index'? What happens when you have both an index.php and index.html, which wins, which loses?

You can use rewrite rules to change something without an extension into .php, but I don't know a way to make it know which one you really wanted.
Sponsored Links
    #3  
Old 07-04-2013
FreddoT FreddoT is offline
Registered User
 
Join Date: May 2013
Last Activity: 23 August 2014, 3:52 AM EDT
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Apache already has settings for that, you can prioritise index files.

I could always have list like


Code:
no extension, .html, .php

or something like that. My point is, your query applies also to .html files.

If I reference a file called "file" then if that doesn't exist it will point to "file.html".
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -4. The time now is 04:42 PM.