没有htaccess的URL重写(没有多页)[重复]

This question already has an answer here:

I have a single page that display stuff depending on a parameter :

domain.com/index.php/?id=foo

works as well as

domain.com/?id=foo

I would like to rewrite the parameter so that

domain.com/foo

also works.

BUT I have no access to the htaccess. I can use PHP and JS/jQuery.

I'm pretty sure this is not possible but I would like a confirmation.

edit : I would like to avoid the multi-pages trick, as the parameter is just a simple js variable and nothing else. These variables will change on a regular basis so I don't want any hardcoded information.

</div>

Well then you have to change the way of setting your files. I meean ..

IF i have this url: domain.com/?id=foo -> It means THAT I have 1 general INDEX, and I am including that FOO page .. (more simple: your index is openning a dir, that is called FOO and gets the content ot it) To make it like this : domain.com/foo , you have to change your way file structure. You still have to make a different folder for each page, but they HAVE TO be in the root dir.

Example for domain.com/foo:

  root dir /
    -> index/ 
        => index.php
    -> foo/ 
        => index.php

Got it ?