简体   繁体   中英

How to display database URL as web page URL in PHP

I have created a web application in php. I display database record on web page with id. My current URL look like below.

example.com/post.php?id=1

Now, I getting all column's value from database where my ID is equal 1 In my database Column URL value on row 1 like below. my-first-page.php I want to display URL like below.

example.com/my-first-page.php?id=1

I want to do this via htaccess file Please experts help me how to do this.

Try this

RewriteEngine On

RewriteRule ^(post\.php)$ /my-first-page.php [L,R=301,NC]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM