gwolff2005 Posted April 29, 2009 Share Posted April 29, 2009 How can I suppress part of the url, so if the complete address is www.guntmarwolff.com/intro.php that it just shows www.guntmarwolff.com Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/ Share on other sites More sharing options...
rhodesa Posted April 29, 2009 Share Posted April 29, 2009 echo parse_url('http://www.guntmarwolff.com/intro.php', PHP_URL_HOST); edit: the http:// has to be in the URL though Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822047 Share on other sites More sharing options...
ignace Posted April 29, 2009 Share Posted April 29, 2009 You need to use a .htaccess and have mod_rewrite enabled on your server Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822051 Share on other sites More sharing options...
gwolff2005 Posted April 29, 2009 Author Share Posted April 29, 2009 @rhodesa. When I do that what you said <?php session_start(); echo parse_url('http://www.guntmarwolff.com/thepassiontest.php', PHP_URL_HOST); ?> and I get this error message: Warning: parse_url() expects exactly 1 parameter, 2 given Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822069 Share on other sites More sharing options...
rhodesa Posted April 29, 2009 Share Posted April 29, 2009 ah...the second parameter was added in PHP 5.1.2...use: $parts = parse_url('http://www.guntmarwolff.com/thepassiontest.php'); echo $parts['host']; Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822095 Share on other sites More sharing options...
gwolff2005 Posted April 29, 2009 Author Share Posted April 29, 2009 Hi. I did that. but now it shows me at the bottom of my page the hosturl. But what I need is that instead of showing in the address bar the path like www.guntmarwolff.com/passiontest.php that it just shows www.guntmarwolff.com. Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822224 Share on other sites More sharing options...
rhodesa Posted April 29, 2009 Share Posted April 29, 2009 AH...in that case...you will probably need an htaccess file. But I'm confused...you used intro.php before and not you use passiontest.php, which is it? Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822321 Share on other sites More sharing options...
Ken2k7 Posted April 30, 2009 Share Posted April 30, 2009 I'm no expert on .htaccess, but this is how I would do it. Haven't tested. .htaccess DirectoryIndex intro.php IndexIgnore * Redirect 301 intro.php http://www.domain.com/ Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822346 Share on other sites More sharing options...
gwolff2005 Posted April 30, 2009 Author Share Posted April 30, 2009 I need this for several pages. But lets stay with thepassiontest.php for now. I dont want to redirect. The user should see the content of thepassiontest.php. But I dont want him to see the actual path in the address bar, but just the main domain www.guntmarwolff.com Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822455 Share on other sites More sharing options...
rhodesa Posted April 30, 2009 Share Posted April 30, 2009 ok...i had a feeling you meant this. before the solution, i would like to encourage you to avoid this. not only is it bad for search engine optimization, but it prevents users from being able to bookmark pages. now, if you STILL want to do it...you need to have the main page be an iframe wrapper. not sure how this would fit into your current structure...but your site index page (usually index.html) needs to be something like: I went to write an example and noticed you already did a frameset on the page (same concept as the iframe). p.s. - I would be curious to hear why you need this Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822545 Share on other sites More sharing options...
gwolff2005 Posted April 30, 2009 Author Share Posted April 30, 2009 hi thanks for your reply. the sites which the user visits are behind a login area. so I dont wanna him try to have access to these pages when he did not log in... as well. there is a psychologigal test running on these sites which the user wants to do. so after doing him I dont wanna him to try to do it again just by bookmarking and visiting again... Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822550 Share on other sites More sharing options...
rhodesa Posted April 30, 2009 Share Posted April 30, 2009 k, well, instead of trying to hide the url, you should fix the pages so it checks to see if they are logged in, and if they aren't, forward them to the login page Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822553 Share on other sites More sharing options...
gwolff2005 Posted April 30, 2009 Author Share Posted April 30, 2009 ok good idea. Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/156159-solved-suppress-url/#findComment-822554 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.