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.
Linking to a specific part of a page - PHP Tutorial
From the course: PHP: Clean URLs on Apache Server
Linking to a specific part of a page
- [Voiceover] In the example site, select Care for Orchids in the main navigation menu. The rewrite rule was created in the previous chapter, loads the page with a clean URL, rewrite/handp/care/orchids. At the top of the page are six links to specific parts of the current page. If you click one of them, it jumps to the selected section. And the URL in the browser address bar now has a hash and a section ID appended to it. This is known as an HTML fragment identifier and it's the normal way to link to a specific part of a page. But let's take a look at that rewrite rule that was created in the previous chapter. Go to the editing program, and here it is in .htaccess online 7. And the incoming pattern ends with orchids, followed immediately by a dollar sign. That means the pattern should reject any URL that contains anything appended after orchids. So why is the rewrite rule still working when we linked to a specific section in the page? It's because webservers ignore the HTML fragment…
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.
Contents
-
-
-
-
-
Creating a clean URL for search results6m 19s
-
Displaying the search results5m 16s
-
Linking to a specific part of a page7m 3s
-
Setting conditions for rewriting URLs2m 52s
-
Creating a clean URL for any PHP file3m 59s
-
Using RewriteMap with a text file7m 43s
-
Using an indexed hash file with RewriteMap6m 26s
-
Increasing the log level to troubleshoot problems5m 30s
-
-