私が欲しいのは、特定のサイトのホストとサブフォルダーを取得できるようにすることです。例: から取得http://example:81/test/
しhttp://example:81/test/pagename.php
ます。
また、同じ URLhttp://example:81/test/
や、http://example:81/test/test2/somepage.php
.
http://example:81/test/images/page.php
still should behttp://example:81/test/
や notなど、フォルダー自体内のファイルの構造を取得するべきではありませんhttp://example:81/test/images/
。
使ってみた
$_SERVER['HTTP_HOST'] // only provides example:81
$_SERVER['REQUEST_URI'] // provides full path example:81/test/images/
基本的に、サブフォルダーにある場合でも、index.phpファイルのURLを取得したいです。
これを達成する方法はありますか?