by ztume
4 replies
Hi,
so i want redirect non www to www But something is going wrong. When i write my url without www it´s redirect to: mydomain/index.php//mydomain

.htaccees file looking like this:

AddType application/x-httpd-php53 php53 php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
Options +FollowSymlinks
RewriteEngine on
rewritecond %{---_host} ^mydomain [nc]
rewriterule ^(.*)$ ------.mydomain /$1 [r=301,nc]


What i did wrong?
#301 #problem #redirect
  • Profile picture of the author Nochek
    AddType application/x-httpd-php53 php53 php
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^$ public/ [L]
    RewriteRule (.*) public/$1 [L]
    </IfModule>
    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,NC]
    Signature
    Nochek Solutions Presents:
    The Hydrurga WSO - Rank Your Site #1 And Score Over The Penguin Updates!
    {{ DiscussionBoard.errors[5629072].message }}
  • Profile picture of the author ztume
    Thanks!
    it's works
    {{ DiscussionBoard.errors[5629391].message }}
  • Profile picture of the author Fiverivers
    I also use this its work thanx for such a nice share.
    {{ DiscussionBoard.errors[5647446].message }}
  • Profile picture of the author bbleo
    here is good code to 301 redirect, write in .htaccess:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^example.com
    RewriteRule (.*) example2.com/$1 [R=301,L]
    {{ DiscussionBoard.errors[5661436].message }}

Trending Topics