recently I have to redesign my site. During the redesign process I create subdomain only for testing my new site. After that I delete the subdomain from my cPanel, but when I type subdomain.name.com that subdomain was steel a live. I contact the hosting company and they told me that I had a wildcard DNS record *.name.com for name.com domain and all requests coming to your site for non-existing domains will be processed by apache without any problems, all the requests will go to puregreencars.com site in such case. I.e if you browse to http://any-word-you-type.name.com/ you will see your http://name.com site. They told me that I can add mod_rewrite rule which disallows or perfrom 301 redirect to common site name. I have no idea how to change my .htacces file. Some friends do that for me but there was problems with friendly url. can anyone here PLS. help me? Here is my .HTACCES file: Options All -Indexes ErrorDocument 404 /404.php RewriteEngine On RewriteRule ^category/([0-9]+).html/?$ index.php?category=$1 [L] RewriteRule ^news/([0-9]+).html/?$ index.php?news=$1 [L] RewriteRule ^all/?(.*)$ index.php?view_all&$1 [L] RewriteRule ^print/([0-9]+).html/?$ print_version.php?id=$1 [L] RewriteRule ^pdf/([0-9]+).html/?$ pdf_version.php?id=$1 [L] RewriteRule ^comments/([0-9]+).html/?$ index.php?comments=$1 [L] RewriteRule ^author/([^<]+).html/?$ index.php?author=$1 [L] RewriteRule ^sitemap.xml$ plugins/sitemap/index.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^.]+)/?$ index.php?category_name=$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^<]+)/([^<]+).html/?$ index.php?news=$2 [L]
RewriteRule ^(.*)$ http://www.domain.com/$1/ [R=301,L] Making it work on all sub-domains with wildcard DNS is what none of us know how to do. Having your webhost get rid of the wildcard DNS record would probably be the easiest thing to do.
Thanks, but it doesent work, when I put the code it acctualy redirect but it shoews a blank site. When I put the old .htacces the site is OK. I'm so mad with my host WOW.