My url is : https://domain.com/chapter-detail.php?board=12&class=145&subject=maths
Now, I want to remove query string from the url and I want to get resultant url as : https://domain.com/chapter-detail.php
My url is : https://domain.com/chapter-detail.php?board=12&class=145&subject=maths
Now, I want to remove query string from the url and I want to get resultant url as : https://domain.com/chapter-detail.php
You can use the following rule to remove query strings fromthe uri /chapter-detail.php
RewriteEngine on
RewriteCond %{QUERY_STRING} !^$
RewriteRule ^chapter-detail.php$ /chapter-detail.php? [L,R]
You can use this
$url=strtok($_SERVER["REQUEST_URI"],'?');