Hello, I have a website written in PHP 5.6 I have a page for viewing a product, the link looks something like view.php? View_id = 5 I would like to replace it with .htaccess with a valid / book / new-book-5 /
1 answer
Enable RewriteEngine and write the appropriate RewriteRule replacement rule. The first parameter is a string or pattern of the incoming link, the second is a match. further may follow, or not follow, flags.
RewriteEngine on RewriteRule ^book/new-book-([\d]+)/?$ view.php?view_id=$1 [NC,L] The NC flag defines a case-insensitive comparison, the L flag completes the current processing cycle. So your link should work in varaints:
/book/new-book-5 /book/new-book-5/ /Book/new-Book-5 |