wwfc_barmy_army Posted June 2, 2009 Share Posted June 2, 2009 Hello. I'm not sure how to go about this but I am wondering how to use a peice of info (a domain) from the address bar. To explain I will use the example of domaintools.com. When you put an address into the text box (in this example google.com) and click submit the address turns to: http://whois.domaintools.com/google.com I am just wondering how you are able to a) load the page even with that domain at the end b) Get that domain as a variable to use from the domain. Thanks for any advice/code. (P.s. I am not creating a whois site lol) Link to comment https://forums.phpfreaks.com/topic/160608-solved-using-info-after-domain-in-address-bar/ Share on other sites More sharing options...
dreamwest Posted June 2, 2009 Share Posted June 2, 2009 htaccess url rewrite Link to comment https://forums.phpfreaks.com/topic/160608-solved-using-info-after-domain-in-address-bar/#findComment-847606 Share on other sites More sharing options...
wwfc_barmy_army Posted June 2, 2009 Author Share Posted June 2, 2009 I know this isn't PHP, but would it be something like: RewriteRule ^/$ /domaincheck.php?domain=$1 Something along those lines? I've never played with htaccess before as you can probably tell lol. Link to comment https://forums.phpfreaks.com/topic/160608-solved-using-info-after-domain-in-address-bar/#findComment-847613 Share on other sites More sharing options...
wwfc_barmy_army Posted June 2, 2009 Author Share Posted June 2, 2009 Actually, I've found some more stuff i've read up on. Would it be more along these lines: RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ domaincheck.php?domain=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ domaincheck.php?domain=$1 Thanks for any advice Link to comment https://forums.phpfreaks.com/topic/160608-solved-using-info-after-domain-in-address-bar/#findComment-847614 Share on other sites More sharing options...
wwfc_barmy_army Posted June 2, 2009 Author Share Posted June 2, 2009 Hello. I have this rewrite code now: RewriteEngine On RewriteRule ^(.+)$ index.php?do=$1 RewriteRule ^(.+)/$ index.php?do=$1 The 'do' variable holds a domain name. So it would be something like: http://mydomain.com/domain.com So domain.com is what I am after. It goes to index.php ok, no problems there. BUT when i try to get the 'do' variable it says it's 'index.php'. Any ideas? Thanks. Link to comment https://forums.phpfreaks.com/topic/160608-solved-using-info-after-domain-in-address-bar/#findComment-847656 Share on other sites More sharing options...
dreamwest Posted June 2, 2009 Share Posted June 2, 2009 RewriteRule ^([^/\.]+)?/?$ index.php?domain=$1 [L,QSA] Link to comment https://forums.phpfreaks.com/topic/160608-solved-using-info-after-domain-in-address-bar/#findComment-847661 Share on other sites More sharing options...
wwfc_barmy_army Posted June 2, 2009 Author Share Posted June 2, 2009 It now says: When i try http://ictwebserv/check/test.com. Not Found The requested URL /check/test.com was not found on this server. Any ideas? Link to comment https://forums.phpfreaks.com/topic/160608-solved-using-info-after-domain-in-address-bar/#findComment-847672 Share on other sites More sharing options...
wwfc_barmy_army Posted June 2, 2009 Author Share Posted June 2, 2009 RewriteEngine On RewriteRule ^([^/]+)?/?$ index.php?do=$1 [L,QSA] worked. Thanks, Link to comment https://forums.phpfreaks.com/topic/160608-solved-using-info-after-domain-in-address-bar/#findComment-847683 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.