Jump to content

.htaccess help please [ www or http://www not working]


Recommended Posts

Hi all  :)

I got a problem, with my host.  I have a free sub-domain, everything works fine and I like it... but there is one problem.

When people visit my website with '[b]www[/b]' or '[b]http://www[/b]' my hosts website appears.  The URL in the browser doesn't change, it stays the same with my sub-domain. The only way you can visit my website (sub-domain) is only with '[b]http://[/b]' and no other way.
Example:
www.mysub-domain.host.com ([b][color=red]NOT WORKING[/color] - hosts website appears[/b])
http://mysub-domain.host.com ([b][color=green]WORKING[/color] - my sub-domain appears[/b])
http://www.mysub-domain.host.com ([b][color=red]NOT WORKING[/color] - hosts website appears[/b])

I emailed the host why this is happening and this is what I got:
[quote]
[b]ME:[/b]
Hello,
Can you please tell me why isn't http://www or www isn't working?

Thanks

[b]HOST:[/b]
Hi there ,

the www is actually a sub-domain /  in its own right , and is unnecessary additional keystrokes .

please have a look at

[b]http://no-www.org/[/b]

[b]ME:[/b]
Hello,
I truly agree with the no www. But is there anyway you can redirect from
http://www or www. to my site http://subdomain.phpnet.us instead of
http://phpnet.us ?  This website has everything and I am truly happy with
it, but I just need to get this little problem fixed as many people still
include www before typing the address, therefore they will see that my
website is supposedly down when in fact not.

Is there any way I can write something in the .htaccess file that would
redirect to my website?

Thank You.

[b]HOST:[/b]
Unfortunately the 'www' is actually a sub domain off the hosting servers , with our homepage on ...

[/quote]

I visited the website I was provided by the host, http://no-www.org/ and on the website I found out a code where you could add it to .htaccess file, and it would make '[b]www[/b]' and '[b]http://www[/b]' redirect.

Here is the code:
[code]RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L][/code]

So now since my host gave me that* website to go to find more info. I assume hes using that code in .htaccess file.

[b]NOW[/b] since I provided you with all the info above, is there anyway to bypass all of that* and make '[b]www[/b]' and '[b]http://www[/b]' work (make them show my website instead of my hosts?
If you got any other questions feel free to ask... thanks alot.



INFO: Host is http://www.phpnet.us/
Here is a picture too of what is happening to make myself more clear.
1. My hosts website.
2. When I visit my sub-domain website with http://sub-domain.host.com works fine.
3. When I visit my sub-domain with www.sub-domain.host.com doesn't work, my hosts website appears.
4. When I visit my sub-domain with http://www.sub-domain.host.com doesn't work, my hosts website appears.
[img]http://img158.imageshack.us/img158/6393/explanationhttpwwwgn5.jpg[/img]

  • 1 month later...
the htaccess file goes inside of the directory containing the file where the initial request is being made. so to use the htaccess you showed above, you'd need to put this either in the directory served by www, or even lower - and i'd bet my left nad on the fact that you dont have this type of access.

busi is right though. if your website is worth enough to you, there a plenty of hosts out there that for only a couple of £ a month will host it, coupled with a domain name of your own. you cant really expect much out of a free host apart from restrictions and/or adverts.

cheers
Mark
Its a DNS (domain name service) feature!

"www.website.com" can be a totally different server to "website.com"

You can try this yourself. Type into the START -> RUN box:
ping www.website.com
and
ping website.com

They would have to add a seperate www DNS subdomain to your existing. They dont seem to want to do that by the sounds of it.
www's at the start of a URL are going out of fashion anyways, and are not needed.

Basically - there is nothing you can do with a htaccess file.
You can BUY your own domain name and then you can do what you like. It'll only cost $11 a year - pennies!

-steve
[quote]www's at the start of a URL are going out of fashion anyways, and are not needed.[/quote]
I disagree with that one part.  If you notice 95% Literally, 95% of the people who use hte internet ALWAYS put www.whatever.whatever.
It's very rare someone will actually remember to do for instance freelancebusinessman.com
It's highly unlikely that someone would type the actual name then .com, everyone is use to www and it will probably always be that way.  99% of the time you check a website, you can check how there dns is setup, 90% of the time it always has to have the www.
Like php freaks, I haven;t tried but htey probably have it where you can do phpfreaks.com and it might work.
If you go around trying some sites, some sites do, but most of them don't, it's not something "I feel" is going to go out of style for a bunch of years.
i just type in the domain and the TDL.  I also notice alot of people at my campus, at home, and at work doing the same thing. WWW is not really needed, and sometimes will take you to a different site as is the problem here. Leaving it off saves typing and always gets you where your going.  an exception, of course, is school websites:

http://carlalbert.edu will take you to the OneNet who hosts our domain so we have to use http://www.carlalbert.edu
I never type the www. either - Although I have noticed a very small amount of websites that require it, which, oddly enough is the case with the websites for some major retail chains here in the UK.

I never advertise my domains with the www. prepended to them either. It's a waste of keystrokes / inefficient use of time - Those milliseconds add up, don't you know!
If you have a sub domain setup then you dont prepend www to the url at all. You only add www when you are not using a subdomain with your TLD.

normal url for access a website with no sub-domain:
www.mysite.com -- real-life example http://www.google.com

if you have a subdomain, then you swap www. with your actual subdomain

my-subdomain.mysite.com -- real-life example http://video.goole.com
[quote author=wildteen88 link=topic=113166.msg484209#msg484209 date=1166035450]
If you have a sub domain setup then you dont prepend www to the url at all.
[/quote]

Only if you have DNS set up that way. ;) You can have DNS accept www.subdomain.domain.com if you want - it's just kinda un-standard practice.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.