0

The problem I m facing that I am receiving an id from url and showing it simply

http://localhost/test/?username=bingo123

Its working fine and shows the result

But I want that I should be able to write like

http://localhost/test/bingo123 .

I tried to make .htaccess file and but it does not work and shows

The requested URL /test/bingo123 was not found on this server

Rewriteengine on
Rewriterule ^([a-zA-z]+)$ index.php?username=$1 

I want to know that what should i change make in .htaccess file or some other settings in Wamp to run the script and where should I save .htaccess so that It works fine .Here "test" the folder name where all php files are there and how to save the .htaccess file as it does not allow it to save without first name.

Thanks in advance.

S.I.
  • 3,250
  • 12
  • 48
  • 77
Vivek Gautam
  • 183
  • 1
  • 1
  • 10
  • Possible duplicate of [.htaccess rewrite query string as path](http://stackoverflow.com/questions/13003319/htaccess-rewrite-query-string-as-path) – Fiddles Dec 14 '16 at 05:59

3 Answers3

1

Try like this

RewriteEngine On
RewriteRule ^test/([^/]*)$ /test/?username=$1 [L]  
S.I.
  • 3,250
  • 12
  • 48
  • 77
0

Myabe Helpful

RewriteRule ^test/([a-zA-Z]+)$ test.php?username=$1 [L]
RewriteRule ^test/([a-zA-Z]+)/([a-zA-Z]+)$ test.php?username=$1/$2 [L]
RewriteRule ^test/([a-zA-Z]+)/([0-9]+)$ $ test.php?username=$1[L]
Soni Vimalkumar
  • 1,449
  • 15
  • 26
0
    RewriteEngine On

 RewriteRule ^test/([a-zA-Z0-9-=_.]+)$ test.php?username=$1 [L]
Hikmat Sijapati
  • 6,869
  • 1
  • 9
  • 19