My pages looks like this:
www.mywebsite.com/work-view?id=1
www.mywebsite.com/work-view?id=2
www.mywebsite.com/work-view?id=3
and so on...
How do I set them like this with .htaccess?
www.mywebsite.com/work/1
www.mywebsite.com/work/2
www.mywebsite.com/work/3
I've already tried like this, but it doesn't work.
RewriteRule work/(.*)/ work-view.php?id=$1
EDIT:
Here's the new code that I'm trying.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^/?work/([0-9]+)$ work-view.php?id=$1 [L]
When I check the page /work-view?id=2 it displays fine, but when I try to enter /work/2 it shows 500 Internal Server Error. Unfortunately on cPanel logs I don't see any error related with this issue, maybe because of some hosting restrictions.
NEW EDIT:
arkascha answer works great, the problem was related with CSS and in my case when I use .htaccess I've changed the paths for the CSS and it's working great.
Here's another code that works great too.
RewriteRule ^work/([0-9]+)/?$ work-view?id=$1 [NC,L] # Handle product requests