Hi
I have one folder named test located at www.mydomain.com/abc/files/test. I need to change the URLs from www.mydomain.com/abc/files/test/test.php?id=15&key=some-text123
to www.mydomain.com/abc/files/test/15/some-text123
this is similiar to SO urls.
I tried following in .htaccess file with following code
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^test/([0-9]+)/([A-Za-z0-9-]+)?$ test/test.php?id=$1&key=$2 [R]
It redirects me to www.mydomain.com/test/test.php?id=15&key=some-text-123
but it didnt work as I copied the format from somewhere. I am not sure ^ should include www part as well or it just assumes / as root?
The "id" part is important to me. I'll also consider followings as valid urls.
www.mydomain.com/abc/files/test/15 (without /some-text123")
www.mydomain.com/abc/files/test/15/ (without /some-text123 but having / )
Can you please help me write correct rule?
How can I make it so that I dont have to hard-code "abc/files/" ?
It shouldn't affect any of the other urls of my site(than "test" folder.)
Also the URL should stay the same (/files/test/15 etc
) instead of changing to "?id=15&key=some-text123"
Thanks a lot.