You are here: Single PHP file - *.php = process, *.phps = source. « PHP Programming Language « IT news, forums, messages
Single PHP file - *.php = process, *.phps = source.

Posted by Lucanos on 01/26/07 01:04

Hi All,

Hoping for some direction here (I have searched, without avail, for a
solution already).

I was toying with trying to find a way whereby I could have a single
PHP file, and then specify whether to either see the processed output
or the source code by using the extensions php and phps (respectively).

So, with one file called "theFile.php" on the server, going to
"www.server.com/theFile.php" would show the end result of the php
actions, whereas going to "www.server.com/theFile.phps" would show the
actual content of the file itself.

I thought this could be done by modifying the htaccess file as follows:

AddType application/x-httpd-php-source phps

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.phps$ $1.php

However this does not work:
- if a *.php file exists, then accessing *.php or *.phps returns the
end result of the php actions.
- if a *.phps file exists, then accessing *.php returns a 404 error,
and *.phps shows the actual file contents.

Looking for any direction, references, or assistance.

Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация