link to PHP page without using .php extension in link

I have a PHP page which captures some information from a user, but when I print the link on a poster for a promotional piece, I do not want to have to have written ".php".

Is there a way to link to this php page without the extension  explicitly written: "www.website.com/form" instead of "www.website.com/form.php"

When I enter it in my browser without the extension, the page cannot be found.

Thank you so much for your help!
hibbsusanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bklyn2001Commented:
you could rename the file index.php and put it in a directory so that by default it would open that file.  for example:

www.website.com/dirname

where dirname is the directory containing the index.php file.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jessc7Commented:
I think bklyn2001's suggestion is the simplest, but you might also look at this post if you plan on modeling this out on multiple files:

http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Apache/Q_26303426.html
0
leakim971PluritechnicianCommented:
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Ray PaseurCommented:
I have just done exactly this thing for my church.  We used a PHP solution to add a 404 handler.  When the page is not found, it will be retried with the .php suffix.  You can see how it works here:
http://www.NationalPres.org/cares 
<?php // nationalpres.org/404handler.php
error_reporting(E_ALL);

if (isset($_SERVER["REQUEST_URI"]))
{
    // IF A PHP SCRIPT IS NOT FOUND GO TO THE HOME PAGE
    if (preg_match('#\.php#i', $_SERVER["REQUEST_URI"]))
    {
        header('Location: /');
        exit;
    }

    // IF A NON-PHP SCRIPT IS NOT FOUND, TRY IT WITH PHP
    $arr = explode('?', $_SERVER["REQUEST_URI"]);
    $arr[0] .= '.php';
    $uri = implode('?', $arr);
    header("Location: $uri");
    exit;
}

// IF NO REQUEST URI
header('Location: /');
exit;

Open in new window

To make this work, we use the following .htaccess file:
ErrorDocument 404 /404handler.php

HTH, ~Ray
0
hibbsusanAuthor Commented:
Ray_Paseur,

I understand the basic gist of what your code is doing, but I do not understand where I should put it. I have the same question here:

To make this work, we use the following .htaccess file:
ErrorDocument 404 /404handler.php

Is ErrorDocument 404 /404handler.php an .htaccess file? Or is it a line with which I should modify an existing file with?

Thanks!
0
Ray PaseurCommented:
It goes in the .htaccess file. All on one line.
0
hibbsusanAuthor Commented:
such a simple solution. it worked perfectly. thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.