Mobile app version of vmapp.org
Login or Join
Welton855

: Stop my website from redirecting to add a query parameter on first visit When I type my web page address for the first time in a new browser, the address is automatically added by some strange

@Welton855

Posted in: #Address #Browsers #PublicHtml #WebDevelopment

When I type my web page address for the first time in a new browser, the address is automatically added by some strange suffix.

e.g.
example.com

automatically become:
example.com/?i=1

This is happen for that address only (my web page address only in this case). It does not happen for other ordinary/ common web page addresses.

It keep happening although:


I clear the cache before typing the address.
I refresh the page for many times.
I open it in incognito browser.


The correct address will be exactly correct if I:


Type again the address in the address bar for the second time onward.
Type again in a new tab in the same browser windows.


How to fix this problem so that I can go to the correct address in every first time I type my web page address? Anybody can help me please?

I am using HTML, Javascript, and CSS.
I am implementing Google Maps API too. That's why I need my web page visitor visit the correct address for the first time.
With /?i=1 suffix, the google maps API will not be displayed because the address is not registered in the google maps developer page.

There are no strange things in my htdocs folder, I suppose. I am not sure that google30bba13d1fbfe55d.html google referrer file and html5reset-1.6.1.css reset file cause it? I am also not sure if my other html file that is not index.html will be the cause?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Welton855

1 Comments

Sorted by latest first Latest Oldest Best

 

@Speyer207

The issue that you have is that adding a query string on the end of the URL causes a redirect, because of this, browsers will naturally cache the redirect, saving the visitor having to hop from one URL to the next on the next visit. That's why its essential that you don't use redirects unless you absolutely don't need to.

You can stop browsers caching by setting the header to no cache, choose one of the methods below:

In PHP

<?php
// NO CACHE METHOD
header("Cache-Control: no-cache, must-revalidate"); // HTTP 1.1
header("Pragma: no-cache"); // HTTP 1.0
header("Expires: Sat, 26 Jul 1997 00:00:00 GMT"); // EXPIRED ON BACK TO THE FUTURE DAY

// EXPIRE METHOD
header("Cache-Control: max-age=2592000"); // 30 DAYS (SECONDS)
?>


In HTML

<meta http-equiv="Cache-control" content="no-cache">


In .htaccess

<ifModule mod_headers.c>
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 21 Oct 2015 00:00:01 GMT" # EXPIRED ON BACK TO THE FUTURE DAY
</ifModule>


You should also be aware that Google and Bing does not take a liking to sites that redirect on first visit, since Google will index that one and not the later, also, it is not allowed that you 'detect' Google or Bing bots and treat them any differ than a normal visitor, e.g by IP or User Agent, and neither use cookies.

Therefore you should ensure that Google is redirected to /?i=1 and since Google or Bing bots otherwise you may be subject to a algorithmic penalty for cloaking.

Redirecting on first visit sounds awful for UX and search engines, but if you must add # rather than ? since Google will treat it as the same page.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme