Reputation: 8207
I know this question was probably already answered but I just don't know what to search for, it would be helpful to at least know what I am looking for.
So what I'd like to do is have link in which there is a number of article to display, like this:
www.mywebpage.com/store/article/[article no.]
Where article no. is just plain number(for example 12345). I'd like to read it in my php script and I'd like the link to be without the ?article=[article no.] which is generated in get method.
Upvotes: 0
Views: 414
Reputation: 2325
What you need to do is redirect script flow to the runnable file handeling the articles. You can achieve this with .htaccess files and mod_rewrite if you are using Apache.
RewriteEngine On
RewriteRule ^store/article/([0-9]+)$ myscript.php?article=$1
This will redirect the script flow internally so that myscript.php sees it as if you accessed myscript.php?article=123
for article number 123 but you will be able to access that with the link store/article/123
.
Thus you can access the article number in myscript.php
with $_GET['article']
.
Upvotes: 0
Reputation: 2194
*mod_rewrite* is the thing you want. In your PHP script, use var_dump($_GET) to see the HTTP request argument.
Upvotes: 0
Reputation: 2182
You need to use .htaccess mod_rewrite
some examples of using it: http://wiki.dreamhost.com/More_.htaccess_mod_rewrite_examples
Upvotes: 2