Removing www. domain

Discussion in 'Installation/Configuration' started by rockan, Apr 26, 2011.

  1. rockan

    rockan New Member

    I want to use my website without www, but the redirect doesnt work on old links.

    If for example, google visits www.domain.com/en, it gets directed to http://domain.com//en/ with double slashes and gets 404 not found.

    My apache directives looks like this...

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
    RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
    RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ (trying to remove doubleslash, doesnt work)
    RewriteRule ^/(.*)$ http://domain.com/$1 [R=301,L] (also trying to remove doubleslash, doesnt work.)

    How do I fix the double slash problem in the redirect? http://www.domain.com/se/index.html becomes http://domain.com//se/index.html 404 not found
     
    Last edited: Apr 26, 2011
  2. falko

    falko Super Moderator Howtoforge Staff

    Shouldn't
    Code:
    RewriteRule ^/(.*)$ http://domain.com/$1 [R=301,L]
    be
    Code:
    RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
    ?
     

Share This Page