How can I rewrite query parameters to path parameters in Apache?

.htaccess, apache, php, url-rewriting

Solution

These are known as `RewriteRule`s, and they are fairly straightforward:

RewriteEngine on
RewriteRule ^about$ /index.php?app=about

Here's the documentation

As far as making it more generic, how about this:

RewriteEngine on
RewriteRule ^([A-Za-z]+)$ /index.php?app=$1

This will make any request to something like /staff or /contact redirect to index.php?app=[staff|contact]

Problem

I currently have a website that I am trying to optimize in terms of SEO. I've got the site working with URLs such as: domain.com/?app=about In my app, `$_GET[app]` is set to 'about', as expected. Now, I want to make it so that a URL like `domain.com/about` is treated as if it were `domain.com/?app=about`. How can I do this in an Apache .htaccess file?

Original source