Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Evanslooten's avatar

Index.php rewrite issue AWS Ubuntu 16.04 / Apache 2.4.18 / PHP 7.2.6

I am in the process of migrating my application to an AWS EC2 instance, but I am having the common issue of requests not being rewritten to index.php. I did some searching on the forums but none of the answers have been able to resolve the issue.

AWS EC2 running Ubuntu 16.04, Apache 2.4.18, PHP 7.2.6

  • Apache VirtualHost has public directory as root, and AllowOverride enabled
  • mod_rewrite is enabled and loaded (phpinfo)
  • mcrypt is enabled and loaded (phpinfo)
  • .htaccess is present in public and exact to the current GitHub version

Any suggestions would be greatly appreciated!

0 likes
1 reply
Evanslooten's avatar

After some playing around I found the issue - Certbot (letsencrypt) added rewrite into the virtual server configuration for HTTP to force redirect to HTTPS, and the virtual server it created for the certificate did not have rewrites enabled.

Hope this can help someone!

Please or to participate in this conversation.