domain.com to www.domain.com redirect Can somebody just give me the simple .htaccess code of this kind of redirect? And also, can I redirect a subdomain to a domain this way, how will it look inside of the .htaccess? Thanks.
I always use the following, it works well : RewriteCond %{HTTP_HOST} ^YOURDOMAIN\.com [NC] RewriteRule ^(.*)$ http://www.YOURDOMAIN.com/$1 [L,R=301] I'm not certain, but you can probably use the same for subdomains, just put the full subdomain in the first line.
Thanks, But if I want to put 2 codes in the .htaccess, do I do it one after the other like that: RewriteCond %{HTTP_HOST} ^YOURDOMAIN\.com [NC] RewriteRule ^(.*)$ http://www.YOURDOMAIN.com/$1 [L,R=301] RewriteCond %{HTTP_HOST} ^SUBDOMAIN.YOURDOMAIN\.com [NC] RewriteRule ^(.*)$ http://www.YOURDOMAIN.com/$1 [L,R=301]
Put this exactly to .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC] RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301] </IfModule>
I'm sorry to annoy, but... This is the subdomain: RewriteCond %{HTTP_HOST} !^www\.domain\.com [NC] And this is the one I want it go to: RewriteRule ^(.*) http://www.domain.com/$1 [L,R=301] Right? And is this a permanent redirect? Will the backlinks to my subdomain now point to my domain? Thanks.
301 ... permanent yes I am using this on all sites without any problem ... just try and type istoritve.com ... and you will see that it redirects you to www.istoritve.com !
301 ... permanent yes I am using this on all sites without any problem ... just try and type istoritve.com ... and you will see that it redirects you to www.istoritve.com !
I need help with this. I can do the redirects no problem but it screws with https urls. How can I redirect any http://site.com -> http://www.site.com BUT NOT https://site.com My probelm is that it ends up redirecting https://site.com -> http://www.site.com and I loose the security.
I'm using Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^domain\.com RewriteRule (.*) http://domain.com/$1 [L,R=301] Code (markup): To redirect hxxp://www to hxxp:// this is affecting the way subdomains react on the server redirecting them to hxxp://domain.com/subdomain Is there a way to fix this so it ignores subdomains?
Hello , I need some help to configure my webserver, sorry for my english.. I would like to redirect http://samedomain.be -> http://www.samedomain.be. I have apache2 and use http.conf to configure the url rewriting. Here's the http.conf file's : <VirtualHost 172.16.51.11:80> ServerName www.samedomain.be ServerAlias samedomain.be DocumentRoot /srv/www/htdocs <Directory /srv/www/htdocs> Allowoverride none Order allow,deny Allow from all </Directory> ExtFilterDefine uncomment mode=output cmd=/srv/www/htdocs/htmclean <Files *.php> ExtFilterOptions DebugLevel=0 SetOutputFilter uncomment </Files> <Files Details> ForceType application/x-httpd-php </Files> <Files Recherche> ForceType application/x-httpd-php </Files> <Files Commandes> ForceType application/x-httpd-php </Files> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.samedomain\.be [NC] RewriteRule ^(.*) http://www.samedomain.be/$1 [L,R=301] </IfModule> </VirtualHost> What's the problem ? > the url rewriting don't work ! I imagine that the rewrite module is not load. In the sysconfig directory/loadmodules.conf, the LoadModule rewriteModule don't exist, if add to load the module and restart apache, the new line is delete. I don't undetstand why it make me not happy, need help Thanks Steve
Steve it looks like you are doing it the hard way. Don't use http.conf use the .htaccess file and add this code: RewriteCond %{HTTP_HOST} ^samedomain\.be [NC] RewriteRule ^(.*)$ http://www.samedomain.be/$1 [L,R=301]