I am making a site which uses the $_GET method to display certain information on a page. I am having some issues with formatting the URL of the page within my htaccess file, as I want to remove variables and shorten my URL to improve the structure and hierarchy of the URL.
My current URL is as follows:
site.com/project?pn=my_project
The 'pn' variable refers to the project name that is being fetched from the server. What I want to end up with is a way for the URL to be as follows:
site.com/my-project
I want to make sure that 'site.com/home' and other pages similar to it are not effected, and that spaces are not treat as underscores, but as heiphens instead.
How would I go about making these changes?
Please note that my current htaccess file includes the following (I'd like to keep it)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
If answers could be explained so that I could rewrite the rule again for another page, I'd be dearly grateful.