404在htaccess工作,但seo友好的网址不起作用的PHP

Hi i am working on a site, i have created an htaccess file for seo friendly urls but it's not working. I have error document 404 line in that file, which works fine but the code for seo friendly url doesn't. I am 100% sure that below code for seo url is correct as it worked in localhost and a server on godaddy too.

SInce my site is now hosted on aws, i think i have to enable or install something to make seo url work. Any suggestions on this ?

This is how my htaccess file looks like, although im sure it doesn't need modification on code level

ErrorDocument 404 http://www.example.com/404.php  

# CODE FOR SEO URL 
RewriteRule ^test/([^/]+)?$ test.php?parameter=$1