Forum Moderators: phranque
I have a web shop and its original site is located at www.example.cz. We then bought another domain: example.ro. We have made a redirection which means that when you enter example.ro in the browser it will take you to default site which is example.cz. Everything works fine, even when redirected the url shows example.ro.
The problem is that I cant create an account or login to the store while Im on the example.ro domain. But if I go to the example.cz domain it works perfectly.
Ive searched and read about the 301 redirects between domains etc. and I have also found this code below which I now would like to have confirmed by you to redirect the whole site.
This is the .htaccess file code:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^(www\.example\.cz)?$
RewriteRule .? http://www.example.cz/specificpage.html [R=301,L]
Please help me out here.
Kind regards,
Thomas
[edited by: jdMorgan at 2:12 pm (utc) on Oct. 1, 2009]
[edit reason] Use "example" for domain. [/edit]
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?
Kind regards,
Thomas
RedirectMatch 301 ^/ http://www.example.cz/specificpage.html
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.
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.
Whats next?
//Thomas
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.
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.
Jim