LaVOZs

The World’s Largest Online Community for Developers

'; php - how to hide id from the url and make it clean url my directory of .htaccess file is /home/evidhya/public_html/tutorials/.htaccess - LavOzs.Com

I have following url i would like to hide id and make it clean url

https://www.evidhya.com/tutorials/tutorials.php?qid=569/AJAX/Introduction

clean url should be like below url https://www.evidhya.com/tutorials/AJAX/Introduction

how can i achieve this

Well, it seems the id is needed to determine the resulting url. I would do this:

RewriteEngine on
RewriteRule (\d+)/(\w+)/(\w+) tutorials.php?qid=$1/$2/$3 [L]

and place this rule in tutorials/.htaccess.

And when someone goes to https://www.evidhya.com/tutorials/569/AJAX/Introduction it should load https://www.evidhya.com/tutorials/tutorials.php?qid=569/AJAX/Introduction

Related
Secure hash and salt for PHP passwords
Get the first element of an array
Reference — What does this symbol mean in PHP?
“Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP
What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?
How to make clean URLs display dirty URLs with .htaccess?
How can hide directory name from the url using htaccess?