Join David Powers for an in-depth discussion in this video Using an indexed hash file with RewriteMap, part of PHP: Clean URLs on Apache Server.
- [Voiceover] In the previous video…we used a plain text file to map the tiles of flower…arrangements to the correct ID using rewrite map.…For anything more than a handful of values…this is likely to slow down the server.…It's more efficient to use a indexed hashfile,…and the first step in creating an indexed hashfile…is to create a text map in exactly the same way as…in the previous video.…There's a copy of map.txt in the chapter three…03_07 begin folder of the exercise files.…
Each line consists of a key and the value you want…rewrite map to look up.…In this case a hyphenated string that will be used as…the URL and the primary key of the related record.…To convert this to an indexed hashfile…it's recommended that you use the apache httxt2dbm utility.…If you're using XAMPP on Windows as your testing…environment it's an .exe file in…the XAMPP\apache\bin folder.…
In WIMP the precise location depends on your version of…WIMP, but you should be able to find all the apache files…in the WIMP\bin folder.…Httxt2dbm.exe is in the apache bin folder.…
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