0

I am using php with aws elasticbeanstalk. I want to create folder that accept this url :

www.example.com/481818

where 481818 present an id that is changed.

so i want to create file that accept every request form this structure www.example.com/integer. and fetch the id.

i don't know how to create this file.

I can do it with this url : www.example.com/?id=4545454 . but I don't want this url structure.

thank you

david
  • 2,960
  • 4
  • 32
  • 54

2 Answers2

2

You have to rewrite all non-existent URLs to a script. On Apache you can make it adding these rules to .htaccess file in your www root.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9]+)$ /index.php?id=$1 [L]
</IfModule>
umka
  • 1,610
  • 1
  • 10
  • 18
1

Put this in you .htaccess file

<IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteRule ^([0-9]+)$ index.php?id=$1 [NC,L]
</IfModule>

It should do what you want, I didn't use elastic-beanstalk before, hopes I can help you.

Hartman
  • 285
  • 4
  • 13