0

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

1

2 Answers 2

1

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]
Sign up to request clarification or add additional context in comments.

2 Comments

Yes, rule is working fine but i did not get any value on that page like:board=12&class=145&subject=maths
After discarding querystrings , you cant get query values as they are not present in the url now.
0

You can use this

$url=strtok($_SERVER["REQUEST_URI"],'?');

2 Comments

This function used to get the url without query string data in the PHP page. but my question is, Can I hide querysting from the url
if you have url as a string then you can use explode("?",Url) function in php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.