redirecting everything but subdomains to www.domain.com, particular issue

Discussion in 'Apache' started by Fed, Oct 30, 2006.

  1. #1
    Hello guys, I'm new to sitepoint and hope this is a nice place to stay
    this is my issue:
    I want to redirect all the traffic from http://domain.com to http://www.domain.com, leaving a subdomain accessible (http://ads.domain.com)
    my problem is due to my htaccess
    
    Options -Indexes +FollowSymlinks
    DirectoryIndex index.php index.html index.htm
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain\.com [NC]
    RewriteRule (.*) http://www.domain.com/$1 [R=302,L]
    RewriteRule ^/?$ browse.php
    RewriteRule ^/?forums/?$ forums/index.html [L]
    RewriteRule ^/?forums/[a-z0-9-]+-([pt])([0-9]+)\.html$ forums/viewtopic.php?$1=$2 [L]
    RewriteRule ^/?forums/[a-z0-9-]+-f([0-9]+)\.html$ forums/viewforum.php?f=$1 [L]
    RewriteRule ^/?forums/[a-z0-9-]+-c([0-9]+)\.html$ forums/index.php?c=$1 [L]
    RewriteRule ^/?forums/[a-z0-9-]+-u([0-9]+)\.html$ forums/profile.php?mode=viewprofile&u=$1 [L]
    RewriteRule ^/?forums/([a-zA-Z0-9_]+),([^/,]+),([^/,]*)([^/]*\.html)$ forums/$1$4?$2=$3 [QSA,N]
    RewriteRule ^/?forums/[a-z0-9-]+-([pt])([0-9]+),([^/,]+),([^/,]*)([^/]*\.html)$ forums/viewtopic$5?$1=$2&$3=$4 [QSA,N]
    RewriteRule ^/?forums/[a-z0-9-]+-f([0-9]+),([^/,]+),([^/,]*)([^/]*\.html)$ forums/viewforum$4?f=$1&$2=$3 [QSA,N]
    RewriteRule ^/?forums/([a-zA-Z0-9_]+)\.html$ forums/$1.php [L]
    RewriteRule ^/?([a-z]+)/?$ browse.php?section=$1 [L]
    RewriteRule ^/?go/([a-z]+)/?$ go.php?category=$1 [L]
    RewriteRule ^/?affiliate/([-A-Za-z0-9_]+)/?$ affiliate.php?category=$1 [L]
    RewriteRule ^/?download/([-A-Za-z0-9_]+)/?$ download.php?filename=$1 [L]
    RewriteRule ^/?search-terms/$ searchcomposer.php?what=$1 [L]
    RewriteRule ^/?images/tutorials/([a-z-]+)/(.*)$ images/tutorials/$1/$2 [L]
    #RewriteRule ^/?([a-z]+)/([a-z]+)/?$ browse.php?section=$1&category=$2 [L]
    RewriteRule ^/?([a-z]+)/([a-z-]+)/?$ browse.php?section=$1&category=$2 [L]
    RewriteRule ^/?([a-z]+)/([a-z-]+)/([0-9]+)/?$ browse.php?section=$1&category=$2&page=$3 [L]
    RewriteRule ^/?([a-z]+)/([0-9]+)/?$ browse.php?section=$1&page=$2 [L]
    RewriteRule ^/?([a-z]+)/([a-z]+)/([a-z-]+)/?$ browse.php?section=$1&category=$2&tutorial=$3 [L]
    RewriteRule ^/?([a-z]+)/([a-z]+)/([0-9]+)/?$ browse.php?section=$1&category=$2&page=$3 [L]
    
    Code (markup):
    I get the message:
    "The requested URL /path/to/document_root/browse.php was not found on this server."

    all I want to do is redirect all the traffic to www, leaving the subdomain ads.domain.com accessible, I don't think it's so hard but I don't get it...can someone help me?
     
    Fed, Oct 30, 2006 IP