I am developing my application on core php and with that I am working on an application in which the index.php file loads all the template files according to the query. e.g; if user want to go to profile page, the url is, sitename/index.php?q=profile
, and for settings page the url is, sitename/index.php?q=settings
.
I want to make it clean url, like for profile the url should be like, sitename/profile
and sitename/settings
.
you could use following code in your .htaccess file to have clean url
RewriteEngine On
RewriteRule ^([a-zA-Z0-9]+)$ index.php?q=$1
RewriteRule ^([a-zA-Z0-9]+)/$ index.php?page=$1