MadeInDreams
MadeInDreams

Reputation: 2126

URL Rewrite and $_POST

So im trying to rewrite my url.

I am under IIS (godaddy.com) I use a web.config file to write my rules.

So right now i have the basic rewrite rule working

  <rewrite>
  <rules>
    <rule name="Rewrite to index.php">
      <match url="^article/([0-9]+)/([_0-9a-z-]+)" />
      <action type="Rewrite" url="index.php?id={R:1}&amp;title={R:2}" />
    </rule>
  </rules>
</rewrite>

Working means that if i type mydomain.com/article/2016/rewrite in the adresse bar it is redirecting me to index.php.

However once on index.php i cant retrieve the value of id and title using

 $_POST['id'];
 $_POST['title'];

$_GET is working but how do i get it to work with $_POST?

Thanks.

Upvotes: 1

Views: 651

Answers (1)

Quentin
Quentin

Reputation: 943586

Data in the URL is placed in $_GET. If you want data in $_POST then you have to put it in the request body when you make the request. URL rewriting can't copy data there.

Upvotes: 1

Related Questions