3

Is there any way that I could I could have a parameter in the URL but not using question mark in PHP?

The inputted url as:

http://www.example.com/y/foo

But it actually parses as:

http://www.example.com/y/?y=foo

but the actual URL which the client has is the original URL.

The /y/ directory does exist and so does the index.php file inside of that.. But the /foo file does not exist.

KeirDavis
  • 665
  • 2
  • 10
  • 32
  • 1
    possible duplicate of [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](http://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained) – deceze Mar 30 '14 at 08:56

1 Answers1

4

This can be achieved via url rewriting. The url structure you are looking for will not be the actual url but it can replace the actual url and make your url look pretty, while the original url is responsible for the page being displayed.

The foo here is a parameter or supposedly argument for a function present on that page.

http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

Nazim
  • 564
  • 5
  • 13