0

My "htdocs" folder is set to this: C:\webserver\xampp\htdocs
All my folders exist in subfolders of this folder.

I have such another folder here: c:\MyProjects\project1

I need to htaccess rewrite so, when I write: http://127.0.0.1/project1/myfile.php On my browser, I will see the result of "myfile.php" inside "project1" folder.

Is it possible?

trante
  • 33,518
  • 47
  • 192
  • 272

1 Answers1

0

Is it possible?

No, you can't rewrite a URI outside of your document root, C:\webserver\xampp\htdocs. And htaccess file sitting in that htdocs directory won't be able to point a request outside of the htdocs directory. Mod_rewrite isn't what you want anyways. You want to use mod_alias from within the vhost config or server config. Something along the lines of:

Alias /project1 C:/MyProjects/project1

See also: Make XAMPP/Apache serve file outside of htdocs

Community
  • 1
  • 1
Jon Lin
  • 142,182
  • 29
  • 220
  • 220