0

I'm looking for a solution where you can change the output of:

echo dirname(__FILE__); # Output: C:\inetpub\wwwroot\hot

To and output of a web path (example/example.html).

Connor Simpson
  • 487
  • 1
  • 7
  • 27
  • You could try getting a [relative path](http://stackoverflow.com/a/2638272/603003) of your file to your document root. But that's only possible if you're using the 'default file serving' ability of your server. As soon as URI rewriting rules are used, you have to roll your own mechanism to build the URI you want. – ComFreek May 23 '13 at 19:10

2 Answers2

1

You need to make your own links. There are an infinite number of possible URLs that may lead to a particular file on the hard disk. Mapping a local path to a URL is not automagically possible.

deceze
  • 510,633
  • 85
  • 743
  • 889
1

Maybe you want the request uri?

echo $_SERVER['REQUEST_URI'];

If not, you must do your custom function/url

Sam
  • 2,950
  • 1
  • 18
  • 26