WordPress.org

Ready to get started?Download WordPress

Forums

Folder to Subdomain- File not found error (4 posts)

  1. skullz
    Member
    Posted 3 years ago #

    Hello,

    I have a word press blog at abc.domain.com , when I point this it works fine, but if I point to domain.com/abc the pages loads without contents(page not found error- no blogs displayed). I found this error due to error logs in cpanel as some search engines redirect to domain.com/abc/(content).

  2. stvwlf
    Member
    Posted 3 years ago #

    It is not going to work when pointing to domain.com/abc because of the way that WordPress does redirection. Your best bet is come up with some mod_rewrite redirection code to place in your top level .htaccess file that rewrites the URL of all traffic coming in for domain.com/abc to abc.domain.com. Then you don't need WordPress to work under two sets of URL's.

  3. skullz
    Member
    Posted 3 years ago #

    Can you explain in detail how to do that?
    Thanks.

  4. stvwlf
    Member
    Posted 3 years ago #

    see if this article helps

    http://terriswallow.com/weblog/2008/htaccess-redirect-a-directory-to-a-subdomain-and-force-www/

    translating its code to your example, you should have

    Options -Indexes +FollowSymLinks
    
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^domain.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com$1 [L,R=301]
    
    RedirectMatch 301 ^/blog/(.*)$ http://blog.domain.com/$1

    place the code in your .htaccess file before the code that WordPress added to the .htaccess file

Topic Closed

This topic has been closed to new replies.

About this Topic