Trouble converting dynamic urls into static

Viewed 79

I'm having trouble converting my website's dynamic URL's into static URL's. My hosting plan is shared via bluehost and I have followed their documentation but to no success. Link attached:

https://www.bluehost.com/help/article/htaccess-tutorial

I've been entering the below into .htaccess but nothing happens whenever I access the relevant pages. The code is as follows:

Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteBase /
RewriteRule -Victorian-Gondoliers-Boat-Hook-(.*)-product-details_id-(.*)\.html$ product-details?Victorian-Gondoliers-Boat-Hook=$1&product-details_id=$2


https://raven-antiques.com/product-details?Victorian-Gondoliers-Boat-Hook&product-details_id=1000001087

To be more exact, I would like to convert the above url into:

https://raven-antiques.com/product-details/Victorian-Gondoliers-Boat-Hook

My product details page is a page-product-details.php dynamic file which relies on GET statements to echo out the unique product details.

Is this a user permission problem given that the hosting plan is shared or have I entered something in incorrectly?

Yours Sincerely, Gregory.

1 Answers

Within your shown samples and attempts, please try following Rules file. Please do clear your browser cache before testing your URLs.

Options +SymLinksIfOwnerMatch
RewriteEngine ON
RewriteBase /
RewriteCond %{THE_REQUEST} \s/([\w-]+)\?([^&]*)&details_id=\d+\s [NC]
RewriteRule ^ /%1/%2?  [R=301,NC,L]

RewriteRule ^([\w-]+)/([\w-]+)/?$ $1.php?$2&$1_id=1000001087 [QSA,NC,L]
Related