Join David Powers for an in-depth discussion in this video Review, part of Clean PHP URLs on Apache Server.
- [Voiceover] Before concluding this course on…clean PHP URLs on Apache server,…let's review what we've covered.…Clean URLs are made possible…by enabling the Apache mod_rewrite module,…which needs to be loaded when the server starts up,…so it must be enabled in the main server configuration file,…you can't load it through an htaccess file.…However, rewrite rules can be defined in htaccess,…in fact, it's the most common way to create clean URLs.…
Rules modify incoming requests,…and point them to the correct location,…without changing the URL in the browser address bar.…Rules defined in an htaccess file…are always relative to the current directory.…Before you can rewrite rules, turn on the rewriteEngine.…The syntax for RewriteRule consists of…the RewriteRule directive, followed by the incoming pattern,…which is usually a regular expression,…and the substitute location.…It optionally ends with one or more flags…inside a pair of square brackets.…
For example, the incoming pattern in this RewriteRule…looks for a URL in the current directory…
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