| 4:52 pm on Oct 1, 2009 (gmt 0)|
Assuming that both 'sites' are hosted on the same server and in the same filespace, that should work.
Have you tested it yourself?
| 5:28 pm on Oct 1, 2009 (gmt 0)|
Hi Jim and thanks for answering,
No havenīt tried it yet because I want to make sure itīs OK first. My orginal site and domain .cz is on one webhotell and the other domain .ro is bought from a different company. We only bought the .ro domain and now want to redirect that domain to the origanl .cz domain though the login feature doesnīt work.
I guess from your answer that my code now wont work?
| 5:31 pm on Oct 1, 2009 (gmt 0)|
Both sites are not hosted on the same servers. I have a controll panel for each domian.
| 6:23 pm on Oct 1, 2009 (gmt 0)|
Since the domains are not hosted in the same filespace, you can simplify. In the .htaccess file in the top-level directory for example.ro, just use mod_alias:
RedirectMatch 301 ^/ http://www.example.cz/specificpage.html
There is no need to use mod_rewrite because you do not need to test to find out what hostname is being requested if the domains are separately hosted.
Because you will no longer be hosting any content on the .ro server, you might consider pointing both domains to the same server using DNS, and then use the mod_rewrite code previously-discussed; There's no need to pay two webhotels if you are really only using one of them to host content.
| 8:32 pm on Oct 1, 2009 (gmt 0)|
Hello again Jim,
When I put the line: RedirectMatch 301 ^/ http://www.example.cz/specificpage.html in the .htaccess file which I placed in the root, (donīt know if it needs to be under the admin folder?) I can not access either the .cz or .ro site. My explorer just keep on loading but nothing happens.
| 2:13 am on Oct 2, 2009 (gmt 0)|
That makes no sense whatsoever if these sites are separately-hosted.
Give me correct information, and I can give you a correct answer...
| 7:23 am on Oct 2, 2009 (gmt 0)|
Sorry, but I dont really understand. What do you mean by "give me correct information"?
Iīve given you all information that Iīm aware off.
| 7:44 am on Oct 2, 2009 (gmt 0)|
He means if you use XYZ.com hosting for the .ro website and ABC.com hosting for the .cz website it is not possible for the .htaccess file from the .ro website to have any effect whatsoever on the .cz website... Even if they are in two different accounts at the same host it is not possible for the .htaccess file from one to have any effect on the other.
The only way it could possibly have an effect is if they are hosted at the same host and share the same file-system. The only other way the .htaccess file could possibly effect both is if you uploaded it to both websites.
What you are describing, by saying they are hosted in two different places and one .htaccess file caused both sites to stop working is like saying you uploaded an .htaccess file to your server and somehow *my* website doesn't work now, because you put a redirect from your site to mine in your .htaccess file... It's not possible.
There are three possibilities I see:
1.) You uploaded the .htaccess file to both websites.
2.) You redirected to the wrong page on the .cz website. (IOW You redirected to a non-existent page and for some reason are not receiving a 404 error, which means you have an issue with the .cz hosting.)
3.) There is something wrong with the page you are redirecting to on the .cz website and it's not loading.
The only way the .htaccess file should be the problem is case #1. You uploaded it to both websites. Otherwise it is most likely the page you are redirecting to is malfunctioning on the .cz website and it needs to be fixed.
Empty your browser cache.
Type the URL you are redirecting to into your browser.
See if the page loads...
If the page loads, copy and paste the URL to the .htaccess file to make sure you are redirecting to the correct page on the .cz site, then re-upload the .htaccess file on the .ro website
If the page does not load, fix the page.
If somehow you uploaded the .htaccess file to both servers, remove it from the .cz server.
Those are the only 3 possibilities I can think of.
| 8:22 am on Oct 2, 2009 (gmt 0)|
I only have one website = .cz The other one = .ro is just a registerd domain name so the .htaccess file has been in the root of the .cz.
I guess that I have to change to another webhotell (hosting supplier) someone who allows 2 or more domains in the same root map?
| 8:43 am on Oct 2, 2009 (gmt 0)|
Yes, you need to have both domains actually hosted, so you can put an .htaccess file in which will affect the .ro site. Some registrars offer 'domain forwarding' I recommend you DO NOT use it. Actually host both sites and set your own .htaccess file to do the redirection... You should be able to find a decent one for $10-$12 a month.
| 9:01 am on Oct 2, 2009 (gmt 0)|
Thank you very much for helping and have a nice weekend.
| 11:28 am on Oct 2, 2009 (gmt 0)|
So this was incorrect:
> Both sites are not hosted on the same servers. I have a controll panel for each domain.
It sounds like the .ro domain is pointing to the same filespace as the .cz domain, and in that case, you will have to use the mod_rewrite solution we originally discussed in order to avoid a 'infinite' redirection loop.
Also, we're having some trouble with terminology, in that the original post above said that both domains *do* resolve to hosting, and that the only problem is that they currently serve the same content, causing a duplicate-content problem for search engines. So both domains currently 'work,' but not the way you want them to.
The code you posted in your first post is good, and should work if placed in the Web root directory that your .ro domain resolves to, regardless of whether the .cz domain also resolves to that same directory; Since the code checks the requested hostname, it should work without any problems as long as "/specificpage.html" exists.