Question:

I want to make all of my web pages have the .php extension?

by  |  earlier

0 LIKES UnLike

I want to make all of my web pages have the .php extension. Wouldn't this make them more flexible so that the files could contain either all HTML or php mixed with HTML?

Also, can I hide the extension so that if people bookmark or link to one of my pages, the file-extension is not part of the URL. For example, what if I did everything in .php and all of my web pages had a .php extension and then I changed from .php to .jsp or something.

I would like to keep the flexibility so that I could change my server-side scripting language without breaking any links or bookmarks. Is this possible?

 Tags:

   Report

2 ANSWERS


  1. The easiest way to 'hide' the .php file extension is through the MOD_REWRITE functionality Apache offers. It involves adding a few lines to a .htaccess file, which tell your web server to open file A when link X is 'typed' (or otherwise entered) in the address bar.

    Searching for mod_rewrite in google gives thousands of tutorials, much better ones than I could ever write myself. But in short, it allows you to tell Apache to open different files than the one in the address bar.

    Doing this, you can rename your files to .php without problems, as your users will only see the address you want them to see.

    http://www.workingwith.me.uk/articles/sc...

    http://httpd.apache.org/docs/1.3/mod/mod...


  2. u use Dw sw.make ur php file & then copy ur whole code in it

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.