Forum Moderators: phranque

Message Too Old, No Replies

Using .htaccess to redirect to parked domain

Use parked domain instead of cpanel domain account was set up with

         

wintercornuk

3:24 pm on Mar 4, 2008 (gmt 0)

10+ Year Member



I've got a client and for the development work I used a .org address. After the sites were built, I then parked their .com address on top using the cPanel facility.

The site structure is example.com/folder, where folder is a country name. There are 20 countries at present.

The problem is, sometimes (not always) when typing in www.example.com/folder it redirects to example.org/folder.

I also want to keep the www. at the front at all times.

I've tried many different .htaccess files and none seem to work the way I want. Is this indeed possible and if so, has anyone any ideas?

Thanks in advance.

jdMorgan

6:26 pm on Mar 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> The problem is, sometimes (not always) when typing in www.example.com/folder it redirects to example.org/folder.

I would recommend you find and correct the root cause of this problem. Using .htaccess to put a band-aid on the problem won't do anything but make it feel better for a little while, but it will leave in place a potentially-serious threat to the successful indexing and optimal ranking of the pages on the site.

I'd suggest running a link-checker such as Xenu on the site, and finding and fixing the links to the non-canonical URLs. Fix any URL-link that you find which results in any kind of error or redirect -- or which should, but does not.

Having done that, you can then use .htaccess to speed up the correction of any 'bad' URLs that have already been indexed in the search engines. This is becoming one of the phrases I type daily, but I guess it bears repeating: "The links on your pages define the 'real' URLs of your pages." No amount of .htaccess coding will change those URLs in any but a temporary and search-engine-robot-confusing way.

Jim

wintercornuk

6:44 pm on Mar 4, 2008 (gmt 0)

10+ Year Member



Thanks for the reply.

I've downloaded the database from the site, changed all the urls to the .com and uploaded again. There are no .org urls left anywhere that I can find so I wonder if it's the fact that the underlying domain is .org?

jdMorgan

5:16 am on Mar 5, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know. I'd get rid of the 'parking' -- whatever that means, and dump cPanel off a cliff if it were my site... ;)

Jim

gergoe

10:50 am on Mar 5, 2008 (gmt 0)

10+ Year Member



Just tell me which cliff that will be, I'm considering to give it a try for a while now, most customers asking for such an administration interface... :-)

jdMorgan

2:38 pm on Mar 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you're providing hosting, then of course you'd want to provide a control panel. But your serious customers will only use the Control Panel facilities to perform functions that can be accomplished in no other way. Why? Because, for example, it:
  • writes absolutely-awful mod_rewrite code. (For example, enable "anti-hotlinking" and then go look at the code it added).
  • allows user to define "Custom Error Pages" by adding "ErrorDocument nnn /path.shtml" directives, but does not check that the designated custom error document exists, and provides no hint that it must exist.
  • has been reported to corrupt existing .htaccess code, or to insert its own code in inappropriate positions.
  • Has little flexibility. e.g. it can only add a subdomain in a separate subdirectory, making 'sharing' of scripts , images, etc. more difficult.
  • has no "undo" facility for most of the above.

    Again, a Webmaster is much better off avoiding its use, except when required -- for example, to modify httpd.conf or conf.d on shared virtual hosting. It must be understood for what it is - a facility for adding pre-coded or "canned" code snippets into server config and .htaccess files.

    Within those limitations, it's OK, but can lead to some serious frustration and problems if used in an uninformed manner.

    Basically, it violates Einstein's dictum: "Make everything as simple as possible, but no simpler."

    Jim

  • gergoe

    8:16 pm on Mar 6, 2008 (gmt 0)

    10+ Year Member



    cPanel is not only about Apache, and that's its strongest point, allows an end-user (or reseller) to manage most of his services, including email, ftp and of course Apache. Now if a customer wants to add an email address, he/she has to go to the mail administartion, if wants to add a new ftp user, he/she has to ask me, and if something is not fine with the Apache configuration, then he/she either need to ask me or play around with htaccess (if it's enabled, used to keep it off, so first it has to be asked from me).

    You are right on most of your objections, but I'm a sort of hosting provider, and also keeps several websites and applications running, and while it would be indeed an extra overhead for me, that pays back on the customer satisfaction.

    Enough has been said, just tell me which cliff it will be ;-)

    jdMorgan

    10:36 pm on Mar 6, 2008 (gmt 0)

    WebmasterWorld Senior Member 10+ Year Member



    Again, I just said avoid using it unless it is required -- on a task-by-task basis.

    I've always wanted to see the white cliffs of Dover, but they're an ocean away...

    Jim