Optimize your URLs for search engines and site visitors. Learn how to use the Apache mod_rewrite module to create clean URLs for PHP sites.
- View Offline
- [Voiceover] Hi, I'm David Powers. Welcome to Clean PHP URLs on Apache Server. In this course I'll show you how to use Apache mod rewrite to make your PHP sites more user friendly by removing file DEM extensions and ugly query strings from URLs. We'll begin by checking whether mod rewrite is enabled on your server. Then we'll look at the basic structure of a rewrite rule. After that, we'll put theory into practice, adapting a small example site to use clean URLs.
You'll see how to convert query strings to numbers or text and how to use an intermediate script to create a clean URL for the results of a search form. We'll also take a look at using a rewrite map to look up complex values without the need for sophisticated regular expressions. Apache mod rewrite has a reputation for being akin to black magic. This course strips away the mystery and will help you create clean PHP URLs on Apache server with confidence.
Rather than checking URLs individually, David shows how to evaluate and update them sitewide with the Apache mod_rewrite module. Watch these tutorials to learn how to enable mod_rewrite on your server, understand the structure of mod_rewrite rules, remove unnecessary file extensions, convert query strings into readable numbers and text, and use rewrite maps to look up complex values without regular expressions. Plus, learn how to enhance search results and provide searchers with links to specific parts of a webpage.
- Checking your Apache setup
- Creating simple regular expressions
- Removing .php from URLs
- Replacing query strings
- Displaying clean URLs in search results
- Linking to parts of a webpage
- Creating a clean URL for any PHP file