haku Posted April 13, 2008 Share Posted April 13, 2008 I want to parse a specific file as php, but I need to have that file with no .php extension on it. I can't use another extension either. For example, I have a file named 'index', not 'index.php', just 'index'. It has some php functions in it. Is there a way to set my .htaccess to process this one file that way? Quote Link to comment https://forums.phpfreaks.com/topic/100891-parse-a-specific-file-with-no-extension-as-php/ Share on other sites More sharing options...
wildteen88 Posted April 13, 2008 Share Posted April 13, 2008 You can use Mod rewrite, rename the index file to index.php first then apply the following rewriterule: RewriteRule ^index$ index.php [NC,L] Calling mysite.com/index will call index.php Quote Link to comment https://forums.phpfreaks.com/topic/100891-parse-a-specific-file-with-no-extension-as-php/#findComment-516062 Share on other sites More sharing options...
haku Posted April 13, 2008 Author Share Posted April 13, 2008 Thanks for the assistance. I couldn't use a .php file extension though for security purposes. I managed to do it this way: <Files filename> ForceType application/x-httpd-php </Files> where 'filename' is the name of the file without an extension. Quote Link to comment https://forums.phpfreaks.com/topic/100891-parse-a-specific-file-with-no-extension-as-php/#findComment-516095 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.