Jump to content

[SOLVED] Link problem


Rommeo

Recommended Posts

Hi

 

my problem is ;

echo <a href=\"".$_SERVER['DOCUMENT_ROOT']."/admin/?module=news\">News</a> 

is not working.

i want it to go to : www.site.com/admin/?module=news

but it gives me the link to : http://www.site.com/home/user/public_html/site/admin/?module=pages

actually i wanted to use the document_root for page not to affected when i include it whereever i want.

 

How can i fix it ?

Or is there any other option ?

 

Thanx in advance.

Link to comment
https://forums.phpfreaks.com/topic/130941-solved-link-problem/
Share on other sites

Use current domain/path to reload

echo "<a href=\"".$_SERVER['PHP_SELF']."/admin/?module=news\">News</a>";

 

Use directory structure of your www folder

include($_SERVER['DOCUMENT_ROOT'].'/path/to/file.ext');

 

You can use document root for the thing above, but I would say it's easier to use PHP_SELF in that case.

Link to comment
https://forums.phpfreaks.com/topic/130941-solved-link-problem/#findComment-679809
Share on other sites

$_SERVER['PHP_SELF']

 

The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar.

 

Will obviously not work for the domain.

Link to comment
https://forums.phpfreaks.com/topic/130941-solved-link-problem/#findComment-679894
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.