Forum
Rewrite rule - is this possible?
I have been reading this - https://24ways.org/2013/url-rewriting-for-the-fearful/ and am trying to get my head around the concepts.
I have a 2 page list detail that results in the detail page url:
https://www.domain.co.uk/detailpage.php?s=title-of-page
- which looks a bit clunky
My question is, is it feasible to rewrite this to just...
https://www.domain.co.uk/title-of-page
by using an htaccess file with something like...
RewriteRule ^([a-zA-Z0-9-/]+)$ /detailpage.php?s=$1 [L]
Or am I still miles off?
cheers
B
Yes, but you probably don't want to do it just like that. That rule will match most URLs within your site, making it hard to have anything else. For example
would get rewritten to
which would be unhelpful. Might it be possible to put the detail pages in a subfolder? Otherwise you'll have to add new rewrite rules for every non-detail page you want to have in the site.