Hi all, Sorry another thread about with or without www. http://forums.digitalpoint.com/showthread.php?t=13665&highlight=FollowSymLinks http://forums.digitalpoint.com/showthread.php?t=1285&highlight=FollowSymLinks What I'm after is, example microsoft.com or microsoft in the address bar will take it to http://www.microsoft.com regardless. But how do you get a URL to behave this way? Someone then posted on my hosts forum some code, Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^yourdomain\.com RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=permanent,L] I've upload it and it works if you type yourdomain in the address bar. But, if you type yourdomain.com it adds //home//yourdomain/public_html/ on the end of the url. Like so, http://www.yourdomain.com//home//yourdomain/public_html/ I've also tried, RewriteEngine On RewriteCond %{HTTP_HOST} ^site.com$ [NC] RewriteRule ^(.*)$ http://www.site.com [R=301,L] And this gave me the same problem. Any sugguestion Andy
Have you taken a good look as possibly your hosting company has some sort of rewrite going on as well.
Hi, I'm not sure old welsh guy. I've submit a support ticket to ukhost4u to ask them, but to be honest I don't know as I've never used htaccess before. I'll try moving around the code to see what happens. Andy
Following code used in my .htaccess on my site at the root of the domain. Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^microplop\.com$ RewriteRule ^(.*)$ http://www.microplop.com/$1 [R=permanent,L] Using Firefox, type microplop.com in the address bar = http://www.microplop.com//home//plop/public_html/ type microplop in the address bar = http://www.microplop.com/ Using Internet Explorer, type microplop.com in the address bar = http://www.microplop.com//home//plop/public_html/ type microplop in the address bar = http://search.msn.co.uk/results.aspx?srch=105&FORM=AS5&q=microplop I'm using UKHost4u and cPanel if that any help. Andy
just a thought microplop, is the the accounts main domain or an addon domain in a sub directory... if the latter it needs to go in the sub folders .htaccess my reason for asking is that the error page on that domain shows as a different domain.
For my experience, the web hosting company that you subscribe to will tell you whether www or non-www URL will be supported by their hosting system. The best way is to check with them. So far I have no problem. My 2 cents.
vagrant, microplop.com is the main domain with 3 addon domains on the same account. The error page is microplop's its just showing details for one of the other accounts on microplop thats all. Its something that needs changing. my44, I'm just emailed to ask if they support www or non-www URL. I have asked them if they offer mod_rewrite in .htaccess files? And can you enable 'AllowOverride FileInfo' and 'Options +FollowSymLinks' in httpd.conf. I'm not sure if there familiar with what it is I've asked. They have said 'there not sure cPanel allows this, and have I tried a redirect?' I've tried setting up a redirect from cPanel but this dosn't do the same thing. Its quite my host allow and if asked will allow for a lot of extra changes so it must be something being looked over there end. Espically if the code I'm using given by everyone here works. Still Andy
My host has informed me that 'Cpanel supports www of non www, both work fine as long as the customer does not play with the www link in the root of their account'. But it still dosn't explain why when I use the mod_rewrite my microplop.com ends up with //home//plop/public_html/ One step forward and two back. Andy
yes that host will work with both, but the problem is non www and www are seen as 2 different sites by some search engines but with the same content. far better to use just the one and redirect the other to it. not sure why its rewiteing the way it is, only thought would be you may need to specify the rewrite base ? but i am sure some of the very wise users here will be able to tell you.
vagrant, I have no issues with the host I'm using as over the last 12months they've really sorted themselves out!! I've also tried posting in cPanels forum regarding this same issue about www and non www but I've heard nothing back. But I don't think its anything I have to change using cPanel or anything that would directly affect cPanel. At the moment I still have the same mod_rewrite code I originally posted, Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^microplop\.com$ RewriteRule ^(.*)$ http://www.microplop.com/$1 [R=permanent,L] in a .htaccess file at the root of microplop.com/ located on a ukhost4u server. Just in case you need any details. I see your point about search engines seeing the www.domain.com and http://domain.com as two seperate sites. Apart from the curiosity about how typing in microsoft and microsoft.com will always lead you to www.microsoft.com I thought I would try myself. I have tried it with a couple of other sites i.e hotscripts.com and 3dtotal.com both do exactly what my site is doing when your type domain.com and domain in the address bar, although I don't know if they are using a mod_rewrite. So its leading me to believe that its just one of those things that I can't have. Unless... and with that I shall leave it to wiser users.
still working on this. Some more info I forgoten regarding the version on my host just incase any of it is needed. Apache version 1.3.33 (Unix) MySQL version 4.1.13-standard PHP version 5.0.4 PERL version 5.8.7 Kernel version 2.6.9-11.ELsmp cPanel version 10.8.0-RELEASE-58
Looking at the Apache version on my host I've tried both examples from the Apache 1.3 URL Rewriting Guide, http://httpd.apache.org/docs/1.3/misc/rewriteguide.html # For sites running on a port other than 80 RewriteCond %{HTTP_HOST} !^fully\.qualified\.domain\.name [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{SERVER_PORT} !^80$ RewriteRule ^/(.*) http://fully.qualified.domain.name:%{SERVER_PORT}/$1 [L,R] # And for a site running on port 80 RewriteCond %{HTTP_HOST} !^fully\.qualified\.domain\.name [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://fully.qualified.domain.name/$1 [L,R] *note, fully\.qualified\.domain\.name example is a bit confusing! Replacing fully\.qualified\.domain\.name with microplop\.com or http://www.microplop.com url. This time the I don't get the trailing ....//home//plop/public_html/ and instead, microplo.com = http://microplop.com microplop = http://www.microplop.com But I'm still left with the problem of having two URL's http:// and www. A bit more progress but I'm still going in circles. Andy