I'm working on a website that is trying to call a link like this:
http://mysite/folder/g=foundation
I'm trying to troubleshoot some Javascript issues.
In the 'folder' subfolder there is an index.php that is looking for a 'g' GET variable.
As far as I'm aware this is incorrect and should be:
http://mysite/folder/?g=foundation
Where that would be sent to index.php in the 'folder' subfolder.
Is the first syntax ok? Is the '?' necessary for maybe having only one GET variable?
NOTE:
This whole site is completely working on a production server. This call works. The version that breaks is on a newer Virtual Machine. Are there any configurations I can make to allow this kind of syntax?
The (?) question mark serves a purpose of indicating the initiation and declaration of query parameters. Excluding it would imply that you have a directory with an equals sign within the name.
RFC 1738 Uniform Resource Locators (URL) December 1994
3.3. HTTP
The HTTP URL scheme is used to designate Internet resources
accessible using HTTP (HyperText Transfer Protocol).
The HTTP protocol is specified elsewhere. This specification only
describes the syntax of HTTP URLs.
An HTTP URL takes the form:
http://<host>:<port>/<path>?<searchpart>
If, however, you must have it your way (without the question mark), you will need to use mod_rewrite
.
To answer you question more literally. Yes. The (?) is necessary.
Depends on the implementation of the server, but syntactically the ? should be required. Otherwise it looks like the browser is asking for an object named "g=foundation" with no parameters (rather than the default object with a parameter named g, which I believe is what you want).
I believe this can be achieved with Apache rewrite module (mod_rewrite)
You can find a few examples here