0

Currently I can call my app (PHP) with the following URL:

http://localhost/app/public/index.html

Is there some way to hide the public in the url, so I can access the app just with http://localhost/app/index.html?

With the .htaccess file it should be possible. I am using XAMPP.

kemal89
  • 931
  • 2
  • 8
  • 20
  • Possible duplicate of [URL rewriting with PHP](http://stackoverflow.com/questions/16388959/url-rewriting-with-php) – Qirel Apr 17 '17 at 13:45
  • why can you just save the .html file in /app folder (ps, for it to run php code the extention must be .php) – jeyejow Apr 17 '17 at 13:47

1 Answers1

0

Don't use mod_rewrite for this. Instead, just set your web server's configuration such that the DOCUMENT_ROOT is pointing to public and not a directory above it. This will have the desired effect as well as preventing your server from handing out things that aren't intended to be public.

Edit: Note, this requires name-based virtual hosting and will require you do effectively dedicate a domain name to your app, but that's not a big deal.

Alex Howansky
  • 50,515
  • 8
  • 78
  • 98