redirecting my-domain.com to www.mydomain.com

Status
Not open for further replies.


Reading that, it looks like it probably is the best way to do (I'm not an expert though). I haven't got server access to edit httpd.conf, so just use .htaccess.
 
Hey guys.. one quick question.. I got this code.. and implemented it..because I completely see the value of it.. now I was wondering when you're editing those files.. what does "Uncommenting" mean.. I'm sure it's something really simple and easy and I look stupid.. but I'd live to know what it means lol
 
Uncommenting means you remove the comment tags. Comments tags are typically # (for .htaccess), /* ... */ or // (for php). If you see

[FONT=Verdana,Helvetica,Arial][FONT=Verdana,Helvetica,Arial]# RewriteEngine On
# RewriteCond %{HTTP_HOST} !www.domain.com
# RewriteRule ^.*$ http://www.domain.com%{REQUEST_URI} [R]

Then the uncommented version is

[/FONT][/FONT][FONT=Verdana,Helvetica,Arial][FONT=Verdana,Helvetica,Arial] RewriteEngine On
RewriteCond %{HTTP_HOST} !www.domain.com
RewriteRule ^.*$ http://www.domain.com%{REQUEST_URI} [R][/FONT][/FONT]
 
  • Like
Reactions: Symmetry Power
oh ok.. I thought it was similar to that.. but I kept on seeing the multiple instances.. thanks for including all those comment tags.. appreciate it.. +rep
 
for lighttpd:

Code:
$HTTP["host"] == "^www.domain.com$" {
        server.document-root = "/home/www/pages/domain.com/www/htdocs/"
        accesslog.filename   = "/home/www/logs/access_www_domain_com.log"
        url.rewrite-once     = (        
                "^/(.*)/$" => "/index.php",
        )
}
else $HTTP["host"] =~ "\.domain\.com$" {
        url.redirect = ( ".*" => "http://www.domain.com$0" )
}
the opposite:
Code:
$HTTP["host"] == "^domain.com$" {
        server.document-root = "/home/www/pages/domain.com/www/htdocs/"
        accesslog.filename   = "/home/www/logs/access_www_domain_com.log"
        url.rewrite-once     = (        
                "^/(.*)/$" => "/index.php",
        )
}
else $HTTP["host"] =~ "\.domain\.com$" {
        url.redirect = ( ".*" => "http://domain.com$0" )
}
 
Status
Not open for further replies.