The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help with sitewide 301 Redirect

Discussion in 'General Discussion' started by nels, Aug 2, 2011.

  1. nels

    nels Registered

    Joined:
    Aug 2, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hello and thanks in advance for any help.

    I'm working on a 301 redirect for a client and can't seem to get the redirect to work sitewide. It's currently only redirecting the index page and I can't figure out how to get it to work for all the pages on the site without setting up individual redirects for each page on the site.

    Here is what cPanel put in the htaccess file after adding the redirect with the option for No Redirect for www.

    RewriteCond %{HTTP_HOST} ^sitename.com$
    RewriteRule ^/?$ "http\:\/\/www\.sitename\.com" [R=301,L]

    I tried using the wildcard redirect but got an infinite loop error. There is some other stuff in the htaccess file, but I can't figure out if it's something in there, or some other problem.

    I'm doing my best to be careful, as it's an important clients site, but after a couple hours of reading forums, I'm no closer to a solution. Any advice would be greatly appreciated.

    Thanks
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    Please provide the full contents of the current .htaccess file in order to determine if those parts are impacting this working.

    Thanks!
     
  3. nels

    nels Registered

    Joined:
    Aug 2, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for the quick response. Here is the entire .htaccess contents.

    Code:
    AddType text/x-component .htc
    <IfModule mod_php4.c>
    php_value session.use_trans_sid 0
    </IfModule>
    RewriteEngine On
    RewriteRule index.html index.php [L]
    RewriteRule index.html index.php?pg=home [L]
    RewriteRule home.html index.php?pg=home [L]
    RewriteRule about.html index.php?pg=about [L]
    RewriteRule sellers.html index.php?pg=sellers [L]
    RewriteRule buyers.html index.php?pg=buyers [L]
    RewriteRule contactus.html index.php?pg=contactus [L]
    RewriteRule under-construction.html index.php?pg=under-construction [L]
    #RewriteRule searchOldetown.html index.php?pg=FPON [L]
    #RewriteRule searchWaterFront.html index.php?pg=FWP [L]
    #RewriteRule searchGolfCommunity.html index.php?pg=FGCP [L]
    #RewriteRule searchNewDevelopment.html index.php?pg=FPND [L]
    RewriteRule searchOldetown.html index.php?pg=searchOldetown [L]
    RewriteRule searchWaterFront.html index.php?pg=searchWaterFront [L]
    RewriteRule searchGolfCommunity.html index.php?pg=searchGolfCommunity [L]
    RewriteRule explore-town-florida.html index.php?pg=explore-town-florida [L]
    RewriteRule town-city-servies.html index.php?pg=town-city-servies [L]
    RewriteRule searchNewDevelopment.html index.php?pg=newdevelopment [L]
    RewriteRule oldetown.html index.php?pg=oldetown [L]
    RewriteRule townwaterfront.html index.php?pg=townwaterfront [L]
    RewriteRule golfcommunities.html index.php?pg=golfcommunities [L]
    RewriteRule newdevelopment.html index.php?pg=newdevelopment [L]
    RewriteRule internationalinvestor.html index.php?pg=internationalinvestor [L]
    RewriteRule mlssearch.html index.php?pg=mlssearch [L]
    RewriteRule mlssearchresult-pg-(.*).html index.php?pg=mlssearchresult&pagenum=$1 [L]
    RewriteRule propertydetail-(.*).html index.php?pg=PROPERTYDETAIL&mlsid=$1 [L]
    RewriteRule featuredpropertydetails-(.*).html index.php?pg=FEATUREPROPERTIESDETAILS&fpid=$1 [L]
    RewriteRule sendmail-(.*).html index.php?pg=sendmail&success=$1 [L]
    RewriteRule privacy.html index.php?pg=privacy [L]
    RewriteRule testimonials.html index.php?pg=testimonials [L]
    RewriteRule team.html index.php?pg=team [L]
    RewriteRule reasons-to-invest-in-town-luxury-real-estate.html index.php?pg=reasons-to-invest-in-town-luxury-real-estate [L]
    RewriteRule standard-of-service.html index.php?pg=standard-of-service [L]
    RewriteRule newdevelopment2.html index.php?pg=newdevelopment2 [L]
    RewriteRule preview.html index.php?pg=PREVIEW [L] 
    RewriteRule mailsentsuccessfully.html index.php?pg=mailsentsuccessfully [L]
    RewriteRule mailsentfailure.html index.php?pg=mailsentfailure [L] 
    <Files 403.shtml>
    order allow,deny
    allow from all
    </Files>
    deny from 91.212.198.37
    
    RewriteCond %{HTTP_HOST} ^towncity.com$
    RewriteRule ^/?$ "http\:\/\/www\.towncity\.com" [R=301,L]
     
  4. nels

    nels Registered

    Joined:
    Aug 2, 2011
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi there,

    I'm still looking for help with my 301 redirect problem. Can anyone help?

    Thanks a million!

    -M
     
Loading...

Share This Page