WordPress.org

Ready to get started?Download WordPress

Forums

Wildcard redirect for WordPress (11 posts)

  1. islifecellascam
    Member
    Posted 2 years ago #

    I have a wordpress installation set up on an add on domain. I was wondering if it is possible to do a wild card 301 redirect on all the pages so that the sub domain does not get indexed by the search engines. Not sure if I need to clarify but shall try. When you purchase a hosting account they assign a primary domain to the account. All of the add on domains are housed in folders within the primary domain. So if I used example.com as an add domain it would be accessible through example.primarydomain.com as well as example.com

    I performed a 301 wild card redirect through cpanel but it only redirects the home page. So, if wanted "example.primarydomain.com/hello" redirected to "example.com/hello" the cpanel 301 option will not work. For some reason wordpress takes presidence over the other files. This is just a single blog and not a multi-user site. In my quest to find an answer it seems to always be related to the multi-user version. Any help would be appreciated.

  2. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    it would be accessible through example.primarydomain.com as well as example.com

    Did you mean that you can host sub-domains, but that if the main domain was primarydomain.com that a sub-domain example would be example.primarydomain.com ???

    Ask host to review this with you.

  3. islifecellascam
    Member
    Posted 2 years ago #

    I do not want the site accessible through the subdomain but only through the add on domain. I am worried about google seeing both web addresses and getting penalized for duplicate content. Already, google has indexed the subdomain version rather than the addon domain which I have appended to the folder. Host would not cover this as it is an issue with wordpress. I can create an html website and use the cpanel wild card redirect and it will redirect every file to the domain. So, if someone manually typed in or tried to visit the subdomain version it would automatically 301 redirect them away from the subdomain and to the domain. What I mean is, if someone went to example.primarydomain.com they would be automatically redirected to example.com

    You see, by default the subdomain is created by the server when an add on domain is created. The subdomain was not created by me purposefully but is just an automatic process. As soon as you go into cpanel and create an addon domain it is filed under the primary domain of the account...hence...example.primarydomain.com

    I want to ensure that my website will redirect all visitors to the domain used for the addon and not be associated with the subdomain created by the addon process.

    website that is not wordpress based can easily accomplish this through creating a wild card 301 redirect. Unfortunately, creating a wild card redirect for a domain that is wordpress based only redirects the home page and does not work for any of the other files as with html based instalations...

  4. kmessinger
    Volunteer Moderator
    Posted 2 years ago #

    I think that is probably because of many of the pages being produced on the fly. The page isn't there when the redirect is applied and only appears latter.

    I want to ensure that my website will redirect all visitors to the domain used for the addon and not be associated with the subdomain created by the addon process

    There are thousands of WP sites out there just using it out of the box so I don't think this is a problem.

  5. islifecellascam
    Member
    Posted 2 years ago #

    But there must be a way to redirect all people going to the subdomain version to just the domain version for all posts and files under the addon domain???

    a wild card 301 redirect for wordpress?

  6. islifecellascam
    Member
    Posted 2 years ago #

  7. kmessinger
    Volunteer Moderator
    Posted 2 years ago #

    Maybe. You can also look here, http://www.askapache.com/htaccess/htaccess.html

  8. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    301 redirects works when your host supports them

  9. islifecellascam
    Member
    Posted 2 years ago #

    I think you must misunderstand...obviously 301 directs work when the web host supports them...cpanel 301 redirects also work on the home page of wordpress sites but not any other...try it...create a cpanel 301 redirect to your wordpress site and then try to access a non home page link through your primary domain subdomain.

  10. ceo
    Member
    Posted 2 years ago #

    In theory a permanent redirect from a subdomain to the primary domain should work, yes. In practice, it does seem to cause random and strange errors because cPanel also creates a bunch of redirects of its own when it creates the addon domain. (It is essentially a domain pointed to folder on another domain.)

    My suggestion is contact your webhost's support and ask them if there's some rewrite rule that's interfering or if they can set it up for you.

  11. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    I see, did you first create a qualified sub-domain and then create the add on domain (both pointing to same folder)? Is so, ask host to fix...

Topic Closed

This topic has been closed to new replies.

About this Topic