-2

Using .htaccess I would like to rewrite Dynamic URLs to Static URLs as follows:

/proddetail.php?prod=xyz123

to become just

/xyz123

I have tried many suggested solutions, way to many to list here, but to no avail. I just can't find the solution and I'm completely at a loss. Any assistance gratefully received.

1 Answers1

1
RewriteEngine On
RewriteRule ^([^/]*)$ /?prod=$1 [L]

http://www.generateit.net/mod-rewrite/index.php

Dan H
  • 3,167
  • 2
  • 30
  • 43
  • Nice interesting tool ! Good pick and quick answer guarantied :) – LoicTheAztec Apr 17 '16 at 01:26
  • No. That didn't do it. – user3138407 Apr 17 '16 at 01:36
  • Have you tried the tool I mentioned above? Play with it, give it a shot. Also, do you have mod_rewrite enabled on your server? – Dan H Apr 17 '16 at 01:38
  • Oh yes. Tried that tool and every other tool I could find, When I said 24 hours I wasn't joking. – user3138407 Apr 17 '16 at 01:41
  • Rewrite/Redirect Query Strings to URI's: http://stackoverflow.com/questions/36353625/replace-index-phpoption-com-k2view-itemid-using-htaccess-and-regex/36360949#36360949 – Ed-AITpro Apr 17 '16 at 02:17
  • Interesting. Based on that link I tries this RewriteCond %{THE_REQUEST} /proddetail\.php\?prod=([^\s&]+) [NC] RewriteRule ^ https://www.domain.com/%1? [L,R=302] and it did rewrite to the correct url but it gave a 404 – user3138407 Apr 17 '16 at 02:28