I’m green @ php or writing htaccess files but i do have some experience with html css and javascript
My problem is that i need to change http://server####.hosting.com/ to http://mydomain.com/ and i’ve figured the way to do it is with htaccess file. I dont know how to use htaccess though. I need that change to be performed in the address bar because showing “server.hosting.com” to my clients is just bad for business.
then use example.com, that’s registered esp. for this case.
but anyways, the only thing that might work is sending a HTTP 301, given that your code is hosted on example.com. otherwise (changing the address, but not the host) this would be called address spoofing.
Instead of the example.co.uk i put the server00000.hosting.com? or instead of http://www.example.com/?
Beacuse i dont know where to put the hosting and where my domain. As i said i am 100% green at this
edit: the way i put it it doesnt work
Could it be that wordpress is managing the site?
edit: it does not work both ways. Am I doing something wrong?
It’s difficult to say without seeing what you have, and yes it is possible that the WordPress setup is affecting something.
In the example I gave the .co.uk domain is being redirected to the .com domain. In your case you need to redirect your domain to the hosting dot com domain.
Did you remember the backslash before the dot in the rewrite condition?
hosting.com is probably not allowing you to use their .htaccess for your redirection. Have you tested that it works? If so, this modification of gandalf458’s code will do the trick:
RewriteEngine on
RewriteCond %{HTTP_HOST} example\.co\.uk [NC]
RewriteRule .? http://www.example.com%{REQUEST_URI} [R=301,L]
Added No Case flag ( {HTTP_HOST} is not case sensitive)
Removed the (.*) ( EVERYTHING atom) and forced match
Replaced $1 with the Apache variable {REQUEST_URI} - no need to capture it again in # 3
Replaced permanent with 301 - same thing but the status code is shorter
You might benefit from reading my mod_rewrite tutorial at http://dk.co.nz/seo as it contains explanations and sample code. It’s helped many SitePoint members over the years and should help you,
It’s been a while but I thought I’d try to help out a bit (again).
The dot character in a regular expression is a metacharacter which specifies ANY character (which includes the dot character). Of course it worked but it does not specify .co.uk any more than it specifies .coXuk or …
Anyway, I hope my “list of modifications” helped as I tried to briefly explain my suggested/recommended changes.