I've been looking, at all of the same questions in here like my own: How to rewrite multiple parameters? And figured how to do, but it doesn't seem to work out very well for me.
I wan't my link to look like this: link.dk/profil/2/overview
And my .htaccess looks like this:
#profil.php?id=? to profil/?
RewriteRule ^profil/(.*)$ profil.php?id=$1 [L]
RewriteRule ^profil/(.*)/(.*)$ profil.php?id=$1&do=$2 [L]
It has to be able to access /profil/2 without the 3rd parameter. That's why I have 2 lines. I don't know if this is the right way to do it.
/profil/2 is working perfect and has been working for a while now. So no worries here. But I can't catch the 3rd parameter.
I'm also having those 2 in .htaccess file:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Before the first two I wrote.
If I am using just the one with 2 parameters it's working. But then it's not working with /profil/2 ofc. And if I enter the url with profil.php?id=2&do=overview - I can access the page.