SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    May 2006
    Location
    Jhyalipati,Chapagaun-9, Lalitpur, Bagmati, Nepal
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Redircting folder to new domain

    Hi,

    I need on help on the following things:


    Right now I have:
    http//www.domain.com => files on root folder.
    http//www.newdomain.com => /newdomain

    If somebody access http://www.domain.com/newfolder/file.html it will redirected to http://www.newdomain.com/file.html


    Regards,
    Sajan
    Simply Sajan

  2. #2
    SitePoint Addict bronze trophy
    Join Date
    Sep 2005
    Posts
    317
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    I don't quite understand the question. Are you asking how to direct a domain to a subfolder?

  3. #3
    SitePoint Zealot
    Join Date
    May 2006
    Location
    Jhyalipati,Chapagaun-9, Lalitpur, Bagmati, Nepal
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Patche View Post
    I don't quite understand the question. Are you asking how to direct a domain to a subfolder?
    Subfolder needs to redirected to different domain.
    Simply Sajan

  4. #4
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,653
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    Sajan,

    Was there a question in that? Perhaps "How do I ...?"

    No worries. In your newdomain directory, include an .htaccess file with the following:

    Code:
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !newdomain\.com$ [NC]
    RewriteRule ^/?(.*)$ http://www.newdomain.com/$1 [R=301,L]
    # Sorry for the /? in this code but, as a subdirectory of domain.com, there should (?) be a leading / in the {REQUEST_URI} received by the newdomain/.htaccess file.
    Of course, that will redirect ANY/ALL file within the newdomain directory to the newdomain.com domain (without the subdirectory).

    Since I've covered all that (and MUCH MORE) in my signature's tutorial, I'll leave the explanation to your reading. Don't worry, if you don't understand, please come back (or PM directly) with questions.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

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