Search code examples
html.htaccessmod-rewriteurl-rewritingfavicon

htaccess rewriting twice in CHROME


I have the following in my htaccess so i can access the page as via domain.com/whatever instead of domain.com/index.php/view/whatever. So this removes index.php/view from the URL. This is working fine in all browser except chrome. Chrome is rewriting the page twice. The way i noticed this is because i have a counter on the page. Everytime the page load, the counter gets incremented by 2. If i remove the rewrite rule then counter works properly and increments by 1. Why is the rewrite happening twice in chrome. Firefox and IE loads the page only once like it should.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/view/$1 [L]

PS: view and whatever are neither files not folders. They are dynamically generated.


Solution

  • Nothing wrong with your htaccess. Make sure you have a valid favicon on your page. This drove me insane once and took me a while to figure out.

    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">