0

I need to ask if it's possible to hide what appears after the ? for example, you have one link like this:

http://www.example.com/product.php?id=10

how can I hide the ?id=10, I'm already hiding the .php with the following code:

RewriteEngine on
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]

RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [NC,L]

But I would like to know how can I hide what is after the ? because currently what it appears like this: http://www.example.com/product?id=10 and should appear like this: http://www.example.com/product

Can someone help me please?

Jay Blanchard
  • 32,731
  • 15
  • 70
  • 112
  • And for page http://www.example.com/product.php?id=11 what do you expect? – u_mulder Oct 12 '18 at 20:42
  • Perhaps use POST instead of GET? – GrumpyCrouton Oct 12 '18 at 20:42
  • 1
    How will your `product.php` script figure out if it should display item `10` or `99` then? – mario Oct 12 '18 at 20:43
  • @u_mulder what do you mean? I just would like to hide it, or probably replace it with something else, but I would prefer to hide it, if possible. – Kacelyn Nardos Oct 12 '18 at 20:43
  • @GrumpyCrouton I know, but I started using GET and now everything is working with GET :( – Kacelyn Nardos Oct 12 '18 at 20:44
  • @KacelynNardos Better to go back now and change it if you don't want it in the URL, rather than wait until you have even more stuff to change. GET variables, by definition, are passed via URL parameters, which means they show in the URL – GrumpyCrouton Oct 12 '18 at 20:45
  • @mario I don't know, I just need it hidded it's not possible to just hide it? I mean whant we remove the .php the website still knows that the page is .php? – Kacelyn Nardos Oct 12 '18 at 20:45
  • What's the purpose of hiding this number? – u_mulder Oct 12 '18 at 20:46
  • @u_mulder, in this case, is a number, but I have the following ones: `index?cat=vehicle%20parts` or `productdetail?prodid=73`, and I would like to hide it to make the url more simple and easy. If there is one way instead of hide replace for example like this `productdetail?prodid=73` with this: `productdetail/prod/73` or `index/category/vehicleparts` – Kacelyn Nardos Oct 12 '18 at 20:50
  • 1
    Possible duplicate of [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](https://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained) – u_mulder Oct 12 '18 at 20:51
  • Possible duplicate of [Removing GET parameter in .htaccess](https://stackoverflow.com/questions/21523311/removing-get-parameter-in-htaccess) – Nick Oct 12 '18 at 20:56
  • @u_mulder so as far as I can see in that link you sent it's impossible to do what I want correct? – Kacelyn Nardos Oct 12 '18 at 20:59

0 Answers0