Hi I need to implement a rewrite rule like this. If user enters this: http://www.mywebsite.com/anydomain.com then I need this URL to rewrite in http://www.mywebsite.com/mypage.php?d=anydomain.com (NOTE: anydomain.com can be any domain name or any tld.) Thanks.
Maybe something like this: RewriteEngine On RewriteBase / RewriteRule ^([^/]+).com$ /mypage.php?d=$1.com [L] RewriteRule ^([^/]+).net$ /mypage.php?d=$1.net [L] RewriteRule ^([^/]+).org$ /mypage.php?d=$1.org [L] RewriteRule ^([^/]+).biz$ /mypage.php?d=$1.biz [L] RewriteRule ^([^/]+).info$ /mypage.php?d=$1.info [L] RewriteRule ^([^/]+).mob$ /mypage.php?d=$1.mob [L] Code (markup): You probably get the pattern from there? You will need to repeat that line for each domain name TLD, since ^([^/]+).([^/]+)$ could do a nasty stuff on your domain name, preventing visitors from accessing index.html for example, or any other file in your root html folder.
Thanks but I have added the similar rules but its not working like RewriteRule ^([^/]+).com$ /mypage.php?d=$1.com [L] if I replace mypage.php with some thing else then it shows the Not Found error page. But if I use mypage.php as in the rule, it just goes on and on until I hit Esc. Please assist.
Hmm odd. Does it work fine if you manually try to open it via yourdomain.com/mypage.php?d=blahblah.com ? Rewrite rule looks fine.. it must be something else then...
Follow these 2 steps... 1. First change the directory index page from index.htm to mypage.php. Place this line on top of .htaccess 2. Once this is done, you can do queries like without rewriting the URL.
Thanks olddocks. But you have given the alternate solution. I dont want to put /?d= in the URL. Please check the URL http://whois.domaintools.com/yahoo.com. I want to do the same functionality. And secondly I have an index.html as well on the site. So I cannot use this kind of thing.