Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2010
    Posts
    196
    Plugin Contributions
    0

    Default .htaccess Redirect does not work

    Hi,

    I have a problem with redirecting mysite
    from http://mysite.com to
    http://www.mysite.com. I did it using CPanel, it did not work at all.

    I have 4 domain names pointing to the same site mysite.com. mysite.com is promary domain.

    I tried to redirect using .htaccess file. Before it looked like this:

    RewriteEngine on
    # Use PHP5 Single php.ini as default
    AddHandler application/x-httpd-php5s .php
    RewriteCond %{HTTP_HOST} ^otherproducts.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.otherproducts.com$
    RewriteRule ^/?$ "http\:\/\/mysite\.com" [R=302,L]

    RewriteCond %{HTTP_HOST} ^otherurl.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.otherurl.com$
    RewriteRule ^/?$ "http\:\/\/mysite\.com" [R=302,L]

    RewriteCond %{HTTP_HOST} ^otherurltest.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.otherurltest.com$
    RewriteRule ^/?$ "http\:\/\/mysite\.com" [R=302,L]

    and after I changed it, it looked like this:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www.mysite.com$ [NC]
    RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]

    And it worked but just for few hours. Today,trying to acces my site, I got
    blank page and changed .htaccess back

    again.

    So the problem is still there. maybe someone knows how to solve it?

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Redirect does not work

    What are your configure.php files set for?
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Mar 2010
    Posts
    196
    Plugin Contributions
    0

    Default Re: .htaccess Redirect does not work

    it stands for http://www.mysite.com withour SSL and for
    https://www.mysite.com with SSL

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: .htaccess Redirect does not work

    If mysite.com is your primart cpanel domain

    Just park the others in cpanel - - no redirection required

    Clean up your other attempts first
    Zen-Venom Get Bitten

  5. #5
    Join Date
    Oct 2010
    Posts
    27
    Plugin Contributions
    0

    Default Re: .htaccess Redirect does not work

    If the HTTP_SERVER constant is set with www.name.com all links will be like that but if you want to redirect the name.com to the www.name.com can insert in the index.php a line like this
    Code:
    if( $_SERVER['HTTP_HOST'] == "name.com") { header("Location: http://www.name.com/"); }
    To me work fine :) if you don`t have 2 domain that point to the same root folder.

 

 

Similar Threads

  1. v150 To Redirect or .htaccess or not
    By dochsa in forum General Questions
    Replies: 8
    Last Post: 10 Sep 2012, 07:13 PM
  2. Download by redirect on a linux server of godaddy won't work, without redirect is ok!
    By popemil in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 26 Aug 2010, 01:37 PM
  3. 301 redirect in htaccess not working
    By FrenchFrog in forum General Questions
    Replies: 10
    Last Post: 24 Aug 2007, 12:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg