Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    May 2008
    Location
    Michigan
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post

    Having issues redirecting subdirectory to domain

    My hosting plan is hosting two domains.

    1) Main domain - abc.com
    2) Blog domain - xyz.com

    The 2nd domain is contained within a subdirectory of the main domain, so abc.com/blog/ is also xyz.com

    I have been trying to edit my .htaccess file to redirect abc.com/blog to xyz.com, but every time I get it work, the stylesheet gets stripped from the xyz.com.

    Can someone please point me in the right direction? The .htaccess file resides in the root directory. Do I need a separate one in the 'blog' directory?

  • #2
    Super Moderator
    Join Date
    Feb 2009
    Location
    England
    Posts
    539
    Thanks
    8
    Thanked 63 Times in 54 Posts
    Try:

    Code:
    RewriteRule ^blog(.*) http://xyz.com$1 [R=301,L]
    You'll need the R=301 to force a full browser reload to the new URL, or edit xyz.com to use relative URLs for the stylesheet (and everything else).
    lamped.co.uk :: Design, Development & Hosting
    marcgray.co.uk :: Technical blog

  • Users who have thanked Lamped for this post:

    nicky (08-20-2012)

  • #3
    Regular Coder
    Join Date
    May 2008
    Location
    Michigan
    Posts
    216
    Thanks
    10
    Thanked 1 Time in 1 Post
    Thank you, that worked!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •