.htaccess Hide GET variable php

Hello I want to hide Get value in php
for example

http://example.com?user=Riyaz_Saifi
to
http://example.com/Riyaz_saifi

There is a good tutorial on mod_rewrite here.

HTH

I want to show user name in URL

That wouldn’t make a lick of sense at all. Why would you use a $_POST request in place of a $_GET request? And I honestly don’t think mod_rewrite is a hack. Now this is a hack.

if(isset($_POST['submit']))

Now that is a real hack and an amateur one I should say. Proper way would be to use.

if($_SERVER['REQUEST_METHOD'] == 'POST')

Getting back on topic, you would have to send all request to a single controller and then make sure that the requested parameter isn’t a valid file, directory, or a symbolic link. Once you have that, you then check that request URL to a database call. And you should be able to get your usernames like so.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.