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.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?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
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.
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...