PDA

Click to See Complete Forum and Search --> : htaccess URL masking


snappel
Oct 26th, 2006, 06:12 AM
Ok, a bit of longshot this one, but here goes...

I have a site hosted on my web space account, for example www.somehosting.com/mysite/home.php. I also have a domain name that I want to use for the site, e.g. www.properdomain.com. At the moment properdomain.com points to www.somehosting.com/mysite/home.php

What I need to do is mask it properly so that properdomain.com/ = somehosting.com/mysite/

This is so that the links on my site are www.properdomain.com/links.php, etc, rather than www.somehosting.com/mysite/links.php.

I've tried using htaccess but I can't quite do it. Well, I did it once using mod rewrite, setting up a rewrite condition for if the pages are accessed from www.properdomain.com...

e.g. RewriteRule properdomain.com/.*$ http://www.somehosting.com/mysite/$1

For a while this worked, and you could access my pages using either domain. Then it suddenly stopped, and the issue seems to be that if the webserver receives a request for www.properdomain.com/links.php, it sees the 'properdomain.com' but and automatically redirects to the homepage (where the domain is 'pointed' to in the domain name settings). In short, the htaccess seems to be ignored.

Any ideas anyone?

kows
Oct 26th, 2006, 02:37 PM
if it worked for a while and stopped suddenly without you changing anything, you should talk to the host of your website and the host of your domain, and ask if they have done anything to prevent what you're doing.

penagate
Oct 27th, 2006, 06:56 AM
You don't need a redirect for that, it's how domain names work anyway. Bind yourdomain.com to the IP of your server and then use your account control panel to locally bind that domain name to your account (this step varies per host and hosting account management software).

BTW, "www" is a pointless abomination. Make sure your domain name also works without it.