.htaccess problems

Discussion in 'Apache' started by massiva, Apr 18, 2007.

  1. #1
    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]
     
    massiva, Apr 18, 2007 IP
  2. massiva

    massiva Active Member

    Messages:
    699
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    78
    #2
    Anyone PLS...

    How to redirect subdomains to my main domain???
     
    massiva, Apr 18, 2007 IP
  3. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #3
    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.
     
    Nintendo, Apr 18, 2007 IP
  4. massiva

    massiva Active Member

    Messages:
    699
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    78
    #4
    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.
     
    massiva, Apr 18, 2007 IP
  5. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #5
    I'm not even sure how you're geting the redirect!! Time to find a new web host!
     
    Nintendo, Apr 18, 2007 IP