I am trying to create a RewriteRule, but it's unreliable and I can't figure out what is happening. Here's my rule:
RewriteRule ^docs/(......)/$ index.php?docid=$1 [L]
the problem is leading slashes, which I have heard is a troublesome thing. What is happening is as follows;
if you include a slash at the end of the url, everything works as expected. however if you don't include the slash at the end, the url turns into this:
It includes the GET data after the url. The funny thing is, the website still works as expected. How does this even happen? according to the rewriterule I made, the url should be look like the following interally:
but after further testing it seems it looks like the added get data is completely ignored. seriously, I tried writing anything after the question mark. Nothing affects the website.
I would appreciate it if someone could explain to me what is happening. Also if someone could show me how to change the rewriterule for the rewrite to work.
- apache-2.2 on debian
- rewriterule written in apache config file.
- no other rewriterules omitted.