I’ve search for some solution to my problem and I found this link. But it doesn’t meet my problem. I’m currently building a website using PHP and I’ve played around with query string in the url. For example, I have a lot of urls like this:
www.example.com?page=something
and also
www.example.com?page=something&action=anything
which I want to have only:
www.example.com/something
and
www.example.com/something/anything
I’m also new to .htacess script so I have no idea what the script means to me even I got some suggestions from Google.
Thanks.
There are different types of architectures for this.
The most common is
mod_rewrite. Using a set ofRewriteRule‘s you can redirect traffic however you like.An example of this would be:
However, management of these rules arguably becomes complex. In your case, you’d have to create another rule for a URL like:
/some/other/pageAnother approach is using the Front-end Controller Pattern. All of your traffic filters through a single place (such as index.php) to be routed. If you are running Apache 2.2.17 or greater (which most servers are these days) you can do this in a single line using
FallbackResource.For example: