Apache configuration question

o3h
o3h used Ask the Experts™
on
Hi. Lets say I have a file called index.php and file called index.php~.

Apache interprets the .php asusual, but just prints the contents of the php~ file.

My question is how to configure apache to read a .x~ file like a .x file?

Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
This part is from Apache configuration file, where you get to define file types to be used as default documents, just add your document name:


# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index.  Separate multiple entries with spaces.
#
<IfModule mod_dir.c>
    DirectoryIndex index.php index.htm index.html
</IfModule>

#
# AccessFileName: The name of the file to look for in each directory
# for access control information.
#
AddType application/x-httpd-php .php .php~
You should have above line in your apache configuration file.
Right now you have probably just "AddType application/x-httpd-php .php"

Restart apache after changing configuration.
How to Generate Services Revenue the Easiest Way

This Tuesday! Learn key insights about modern cyber protection services & gain practical strategies to skyrocket business:

- What it takes to build a cloud service portfolio
- How to determine which services will help your unique business grow
- Various use-cases and examples

o3h

Author

Commented:
I would like several files to work the same way. For example:

allfiles.php allfiles.php~
allfiles.html allfiles.html~
... ... ...

You are talking about the file /etc/apache2/apache2.conf?

Commented:
yes, this is the conf file you need to edit to add the default documents you need.
Normally , it is httpd.conf.
if you use this etc/apache2/apache2.conf?

you should try to open and find :

<IfModule mod_dir.c>
    DirectoryIndex ....
</IfModule>

if it exists , it is correct file you should change

Regards,
VDC
<input id="gwProxy" type="hidden"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden">

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial