Printer Friendly Version
Email this thread to a friend
|
Featured Web Site Template |
|
There are 0 guests and 1 members in the forums right now.
Reflects user activity within the last 5 minutes
|
|
| Member |
Message |
SmartROI
Joined: Nov 18, 2003
# Posts: 288
|
Posted: 11/06/2005 04:08 pm
Hey maybe you all can help me with a problem I'm having.
One of my client sites is showing up something like:
client.com
www.client.com
www.host.com/~client/
host.com/~client/
and I want everything to show up as www.client.com instead of all the variations.
currently in apache .htaccess I've tried.
301 Redirect / http;//www.client.com
it doesn't work. This works...
301 Redirect oldpage.php http;//www.client.com/newpage.htm
(with : instead of ; )
but that's not the problem. The problem is that I want all the index.htm pages and all pages on the site to resolve as the full URL for www.client.com/
(with the WWW)
|
 |
g1smd
Moderator
Joined: Jul 28, 2002
# Posts: 10183
|
Posted: 11/06/2005 04:50 pm
This bit is correct for sure:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^client.com [NC]
RewriteRule ^(.*)$ http://www.client.com/$1 [L,R=301]
I am not sure how to handle the folder part, so this bit might not work:
RewriteCond %{HTTP_HOST} ^host.com/~client/ [NC]
RewriteRule ^(.*)$ http://www.client.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www.host.com/~client/ [NC]
RewriteRule ^(.*)$ http://www.client.com/$1 [L,R=301]
This all goes in the .htaccess file in the root folder of the site.
|
 |
SmartROI
Joined: Nov 18, 2003
# Posts: 288
|
Posted: 11/07/2005 12:44 am
Uh oh.
When I do just the top part and type in
client.com
instead of www.client.com
the resulting page is a 404 error page.
Likewise with client.com/page.htm
Bottom part didn't work at all .
|
 |
lizardz
Joined: Nov 12, 2004
# Posts: 1394
|
Posted: 11/07/2005 10:53 pm
"www.host.com/~client/"
this means that the hoster is already using some type of rewriting to direct requests for your client's site to that folder.
There is one and only one solution that is even worth spending more than a few seconds here: move to a real webhoster and stop wasting your time.
Trying to work with junk webhosting is a total waste of your time. If I had a client that asked me to do that I'd tell them politely that every problem I run into with the bad hoster will be billed at $100 per hour. Or they can just move to a real hoster.
|
 |
g1smd
Moderator
Joined: Jul 28, 2002
# Posts: 10183
|
Posted: 11/08/2005 04:43 pm
Right. Try this:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^client\.com [NC]
RewriteRule ^(.*)$ http://www.client.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^host\.com [NC]
RewriteRule ^~user/(.*)$ http://www.client.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.host\.com [NC]
RewriteRule ^~user/(.*)$ http://www.client.com/$1 [R=301,L]
Remove all the blank lines from within the code.
Add a blank line after the last line of the code.
[ Message was edited by: g1smd 11/09/2005 06:25 am ]
|
 |
SmartROI
Joined: Nov 18, 2003
# Posts: 288
|
Posted: 11/08/2005 05:26 pm
"move to a real webhoster "
Shoot... now I have to either fire myself or charge myself $100 an hour.
|
 |
lizardz
Joined: Nov 12, 2004
# Posts: 1394
|
Posted: 11/08/2005 05:56 pm
It crossed my mind as I posted that that maybe you were hosting the site yourself.
But you've setup your server wrong in that case, that's not how you do it, you want to use virtual name based hosting, it doesn't work like the way you're doing it now, it just allows apache to handle all requests for different domains without using that folder hack.
I have maybe 50 sites running on my local server, each is a real site, accessible at the flick of a switch over the web, if I point all the dns stuff to them and open up my port 80 etc. You can't reach any of them unless you put in the correct domain name.
I would do both, fire yourself, and charge $100 an hour to fix the setup, that way you'll get a nice break, and also some good pocket change. Plus you'll have real site addressing etc as a bonus. Win win win.
If I remember my IIS right, and I'm really stretching my memory here, this is totally possible with IIS too, it's really easy setting up new sites there too that are standalone.
If it's apache though, and if you have access to httpd.conf, this is really easy to do.
I've noticed a certain tendency to not learn how to set up multiple sites on apache, I don't know why that is, maybe because the xamp packages don't do that by default, don't ask me, no idea, but it's really easy to do it right.
|
 |
g1smd
Moderator
Joined: Jul 28, 2002
# Posts: 10183
|
Posted: 11/10/2005 07:09 am
Did the new code, above, help at all?
|
 |
SmartROI
Joined: Nov 18, 2003
# Posts: 288
|
Posted: 11/11/2005 01:23 pm
Well folks. thanks for the help. I finally got ahold of one of our techs and he made some adjustments in apache I believe.
So, the htaccess help is no longer needed. Thanks though!
Tony
|
 |
lizardz
Joined: Nov 12, 2004
# Posts: 1394
|
Posted: 11/11/2005 01:31 pm
Oh, it's apache, yes, all that's required is setting up virtual sites, in httpd.conf, and adding the 301 into each virtual site directory. It's pretty easy.
httpd.conf changes are always preferable to .htaccess, but almost no shared hosting will allow users to touch httpd.conf, since any error will crash all the shared sites. But httpd.conf changes are more efficient, since apache boots up with those changes locked in, .htaccess changes have to be processed each page request, over and over.
Wait, does this mean you didn't have to fire yourself? And you didn't have to pay yourself $100 an hour? That's probably good.
|
 |
g1smd
Moderator
Joined: Jul 28, 2002
# Posts: 10183
|
Posted: 11/11/2005 06:54 pm
Now use WebBug to check that three of the URL variations give a 301 redirect for any page of the site that you try to access, and the fourth returns the correct page with status of "200 OK".
|
 |
You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
- You have not yet logged in, or registered properly as a member
- You are a member, but no longer have posting rights.
- This is a private forum, for which you do not have permissions.
If you are a recent member, it's possible that you simply have not yet confirmed your account. Please
check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions
contained within.
If you cannot find this message, click here to Re-Send it.
|
If you are still experiencing problem, please read the
Login Assistance
Article for some advice on what may be causing your login not to work properly.
|
Switch to Advanced Editor and ...
Create a New Topic
or Reply to this Thread
|
|