Join David Powers for an in-depth discussion in this video Enabling mod_rewrite in the Apache configuration file, part of PHP: Clean URLs on Apache Server.
- [Voiceover] Let's say that you run test.php,…and you get a message similar to this,…mod_rewrite is not enabled.…Although you're running php in cgi-mode on Apache,…but the script can't determine whether mod_rewrite…is enabled or not.…As long as you're able to edit the Apache configuration,…turning on mod_rewrite is very simple.…However, if you've got a message that your server…is running on Engine X, or anything other than Apache,…this course isn't relevant to you.…Engine X and other servers do have URL rewriting routines…that are similar, but they're not covered in this course.…
And if you've got the message that the script…couldn't determine the server type,…you'll need to consult your hosting company…or server administrator to see whether…you're running Apache, and whether mod_rewrite is enabled.…But assuming you are running Apache,…and that you can edit the configuration,…you need to open the main configuration file.…The location depends on your operating system and setup.…I'm running XAMPP on Windows,…so let's go to my file explorer,…
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