I need help with using RewriteCond
properly in my .htaccess
.
I have a simple php file which accepts 2 get parameters and returns a JSON object. Well, I wrote a simple Rewrite Rule to make my url pretty and understandable.
Although after adding a form, obviously the Rewrite Rule won't get triggered because it will send a standard 'raw' URL.
My normal URL looks like this:
www.example.com/?ost=1&song=2
After my Rewrite Rule:
www.example.com/ost/1/song/2
But the form sends the url like this: www.ost.com/?ost=1&song=2
After searching a bit, I found out that RewriteCond
could help but I am not familiar with it.
Edit: I have been asked for my Rule, so here it is:
RewriteRule ^(ost)/([^/.]+)/?(song)?/?([^/.])?$ index.php?$1=$2&$3=$4
I forgot to mention that the song parameter is optional but this doesn't matter.