简体   繁体   中英

htaccess rewrite URL for dynamic content

I am wondering how would I change the url from:

single.php?id=1

to:

quote-1

Each submitted data has an id, of course. They can go to the URL, the id of the "quote" to get the quote. How would the URL rewrite look? I've tried to use tools online, but ether they didn't work or I didn't understand how to use it.

Place the following your .htaccess file:

RewriteEngine on
RewriteRule quote-(\d+) single.php?id=$1 [QSA]

mod_rewrite documentation

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