Free Web Hosting Forum
(#1 (permalink))
Old
Junior Member
losakaniroshan is on a distinguished road
 
Posts: 16
Join Date: Jul 2012
Location: UK
Thumbs up 301 redirect with htaccess - 08-14-2012, 05:25 AM

I want to 301 redirect my normal url to www url using htaccess file.
Ex- http://mydomain.com to http://www.mydomain.com

Please tell me the code I must put in the htaccess file.

Last edited by d3iti; 08-14-2012 at 09:26 AM. Reason: Title
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
Member
AdrianL is on a distinguished road
 
Posts: 35
Join Date: Dec 2011
Location: USA
Send a message via MSN to AdrianL Send a message via Skype™ to AdrianL
Default 08-14-2012, 05:31 AM

There is an option to handle redirects within the control panel. Its called "Redirects" and has the icon of a flag / house


Experienced web designer / game developer available for hire
portfolio | email me | cv / resume

"No Gods or Kings, only Men."
- Andrew Ryan, BioShock
Reply With Quote
(#3 (permalink))
Old
Junior Member
losakaniroshan is on a distinguished road
 
Posts: 16
Join Date: Jul 2012
Location: UK
Default 08-14-2012, 06:33 AM

Quote:
Originally Posted by AdrianL View Post
There is an option to handle redirects within the control panel. Its called "Redirects" and has the icon of a flag / house
That redirect system is not working for me.I can redirect to a another site but not the same url.
Reply With Quote
(#4 (permalink))
Old
Banned
www.greenfive.tk is on a distinguished road
 
Posts: 21
Join Date: Aug 2012
Location: In the pub
Default 08-14-2012, 06:54 AM

Google webmaster tools will solve your issue. Few days ago I changed mine address to http://www (when I started was just www. )
https://support.google.com/webmaster...n&answer=44231
and this 2 links for the htaccess: https://support.google.com/webmaster...n&answer=93633
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

Last edited by www.greenfive.tk; 08-14-2012 at 07:00 AM.
Reply With Quote
(#5 (permalink))
Old
Junior Member
losakaniroshan is on a distinguished road
 
Posts: 16
Join Date: Jul 2012
Location: UK
Default 08-14-2012, 08:01 AM

Quote:
Originally Posted by www.greenfive.tk View Post
Google webmaster tools will solve your issue. Few days ago I changed mine address to http://www (when I started was just www. )
https://support.google.com/webmaster...n&answer=44231
and this 2 links for the htaccess: https://support.google.com/webmaster...n&answer=93633
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
I read and use apache 301 redirections an they are not working.I think its because we are using Apache ver.2.2.19 not 2.0 .I am not talking about search engines.Just this.
When you type http://000webhost.com/ it goes to http://www.000webhost.com/

And When you type http://www.000webhost.com/ also goes to http://www.000webhost.com/

Please somebody help me.
Reply With Quote
(#6 (permalink))
Old
ShocK's Avatar
Senior Member
ShocK is on a distinguished road
 
Posts: 4,231
Join Date: Jul 2011
Location: UK
Default 08-14-2012, 08:19 AM

Hi, google search for "htaccess www" and found this in first link
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
http://enarion.net/web/htaccess/redi...ww-and-no-www/

EDIT:
Typing this in google (your question) gives you the same answer
Quote:
I want to 301 redirect my normal url to www url using htaccess file.

Last edited by ShocK; 08-14-2012 at 08:22 AM.
Reply With Quote
(#7 (permalink))
Old
Junior Member
losakaniroshan is on a distinguished road
 
Posts: 16
Join Date: Jul 2012
Location: UK
Default 08-14-2012, 08:34 AM

Yes my friend.I search in google before post here.I got confused because the code is not the same in all sites.In each site the code has some differences.But at last I found a working one.

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com