homepage Welcome to WebmasterWorld Guest from 54.237.54.83
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Please confirm my Redirect
redirection of domain
Tholin




msg:3999263
 2:04 pm on Oct 1, 2009 (gmt 0)

Hi there,

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 can’t create an account or login to the store while I’m on the example.ro domain. But if I go to the example.cz domain it works perfectly.
I’ve 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]

 

jdMorgan




msg:3999376
 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?

Jim

Tholin




msg:3999397
 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?

Kind regards,
Thomas

Tholin




msg:3999399
 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.

jdMorgan




msg:3999428
 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.

Jim

Tholin




msg:3999477
 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.
Whats next?

//Thomas

jdMorgan




msg:3999604
 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...

Jim

Tholin




msg:3999698
 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.

jd01




msg:3999711
 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.

Tholin




msg:3999722
 8:22 am on Oct 2, 2009 (gmt 0)

Hi there,

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?

jd01




msg:3999726
 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.

Tholin




msg:3999728
 9:01 am on Oct 2, 2009 (gmt 0)

Thank you very much for helping and have a nice weekend.

jdMorgan




msg:3999799
 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.

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved