URL hiding in PHP
How do I display another url or main domain name instead of filename in php? For example suppose I am redirected to file http://example.开发者_JS百科com/myfolder/test.htm, then instead of specified url I want to display example.com in the address bar for such url. How can it be done?
you can do this with .htaccess here is a useful link.
Not with PHP, you can use Frames for that, but this isn´t relay a good design I think...
This can not be done in php. PHP is server side language and the request sent is from user.
So if you want user to open http://www.example.com and show http://www.example.com/folder/script.php page use URL REWRITE.
But if you want a user who have opened http://www.example.com/folder/script.php to show http://www.example.com in address bar but still show script.php content.
On accessing script.php page redirect to http://www.example.com/ and in your index page check for referrer. If its script.php (within your own domain) just include that page.
It will be a long work but it depends what you need. Its just an idea.
精彩评论