From the course: PHP: Clean URLs on Apache Server
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Removing .php from the URL - PHP Tutorial
From the course: PHP: Clean URLs on Apache Server
Removing .php from the URL
- [Voiceover] This is arrangements.php in the h and p example site. From this point onwards, you need to work in the h and p folder of the exercise files. The folders for each video that have begin and end folders contain only files that change. So let's take a look at arrangements.php in a browser. If we click "Flowers," it takes us to flowers.php. "Care for Orchids" takes us to orchids.php, and "Arrangements" takes us back to the original page, arrangements.php. The first step most people take towards clean URLs is to remove the .php from the file name. A common way to do that is to create a separate directory for each page and rename the file index.php. That definitely works, but you end up with a huge number of directories, and every file with the same name. Let's see how to do it with mod_rewrite, so back to my editing program. And the first step is to create an ht access file. But where should we put it? If we put it here in the site root, that will affect the whole site. That's…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.