0

Say I run

http://mymaindomain.com/helloworld/somescript.php

I want http://mymaindomain.com/helloworld/

How do I do so?

user4951
  • 32,206
  • 53
  • 172
  • 282
  • Not the directory inside the machine but the directory that face the public. So not /root/htdocs/public_html/helloworld/ more like http://domainname.com/helloworld/ – user4951 Dec 31 '16 at 11:55
  • Possible duplicate of [Get absolute path of current script](http://stackoverflow.com/questions/4645082/get-absolute-path-of-current-script) – adampweb Dec 31 '16 at 12:49
  • http://php.net/manual/en/reserved.variables.server.php –  Dec 31 '16 at 12:50

1 Answers1

1

Would you please check my answer?

https://stackoverflow.com/a/41407858/3821823

You can also define const variable like this:

const BASE_URL = 'http://mymaindomain.com/helloworld/';
// or
define('BASE_URL', 'http://mymaindomain.com/helloworld/');

echo BASE_URL;
Community
  • 1
  • 1
Ali
  • 1,358
  • 3
  • 21
  • 32