I'm making a writer's website and I want to showcase some books, and then some excerpts.
I want the URLs to look like this: site.com/book/name-of-book site.com/book/name-of-book/excerpt
I managed to do the first part with this htacess:
Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f # Remove .php from regular pages RewriteRule ^([^\.]+)$ $1.php [NC,L] # Directory style books RewriteRule ^book/(.*)$ ./book.php?slug=$1 # Directory style books excerpts RewriteRule ^book/(.*)/excerpt$ ./book-excerpt.php?slug=$1 My problem is the second part as it is not working, the book.php is loaded, instead of book-excerpt.php.
I've been researching on how to do this, but all solutions throughout the web seem to not work for me. What am I doing wrong? Is the first rule overriding the second? How can I fix this?