URL重写解析为地址栏中的实际URL

I have a strange issue where on some users machines the rewritten url's are resolving to their actual url in the address bar.

I have the following in my htaccess file

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

I have noticed these appearing in my analytics which is messing up my stats as there are two url's for one page.

An example of this is:

http://example.com/news/the-first-post

http://example.com/index.php?url=news/the-first-post

I have on occasion been able to replicate the issue myself by directly typing the rewritten URL in the address bar.

Have your rules like this:

RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+index\.php\?url=([^\s&]+) [NC]
RewriteRule ^ /%1? [R=301,L,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

Now all URLs with /index.php?url=news/the-first-post structure will be 301 (permanent) redirected to /news/the-first-post.