I have some URLs like this:
www.mydomain/works/show.php?slug=title-of-the-work
I'll like to have htaccess convert to seo URLs in this way:
www.mydomain/works/title-of-the-work
In my database I have created a field called slug for every work entry. The first URL works fine.
This is how my .htaccess currently looks (it is placed in my root directory):
RewriteEngine On
RewriteRule /works/(.*)$ /works/show.php?slug=$1
I've read and tried a lot of similar examples during the last 24hours to no avail. I'm sure my server allows rewriting, because I can for example rewrite non-www to www URLs. Hope someone can help. Thanks
Use:
RewriteEngine On
RewriteRule ^works/(.*)$ works/show.php?slug=$1 [L]
You can also put your .htaccess file into works folder with this code:
RewriteEngine On
RewriteRule ^(.*)$ show.php?slug=$1 [L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With