I got a PHP index document that is loaded when I visit my site, in the address bar it doesnt show the expected www.samplewebpage.com/index.php but it just shows www.samplewebpage.com. I am using background scripts that depend on a extension to that url e.g. www.samplewebpage.com/index.php?page=index but that doesn't really work as expected since there is no /index.php to add that "variable" to.
I have looked around for some time but only found something like how to detect page load and how to change page url, but not them both in one script. I'm not sure if this is mixed Ajax and jQuery since I am not that into those yet but i'd apprechiate some help.
So I want to know how to change the url when the index page loads, I got a script that should work but doesn't.
<script type="text/javascript">
$(document).ready(function (){
history.pushState("", "", "www.mysamplepage.net/index.php/?page=index");
});
</script>
note: the link is not an actual website, its just for demonstrational purposes.
EDIT: Well to fix the initial problem I just had to add an line before my script:
But how does the pushState work? I want to add "/foler/index.php/?page=index" on page load, Only if there isn't already the index.php there