SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot forum11's Avatar
    Join Date
    Feb 2006
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mod_rewrite for subdomain (php site)

    I am using this rule for main site and subdomain (both have their own .htaccess)

    RewriteRule ^(.*)-(.*).html /moredetails.php?pid=$2

    and it is working fine for both (www.example.com and subdomain.example.com)
    but when I access subdomain as www.example.com/subdomain then the htacess inside subdomain folder is not working and it executing root .htaccess

    Can anyone tell exactly what the problem is and how can it be sorted out?

    Regards
    Do Good Have Good!

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Easy solution. Only access it through the subdomain, and put a robots.txt in place to make sure search engines never try to crawl /subdomain even if someone finds and links to it.

  3. #3
    SitePoint Zealot forum11's Avatar
    Join Date
    Feb 2006
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But I need both to be working (sub.example.com and example.com/sub)
    Do Good Have Good!

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Then you need to modify the .htaccess file in the root to not match URLs beginning with /subdomain. You can either make that part of the pattern or add a RewriteCond.

  5. #5
    SitePoint Zealot forum11's Avatar
    Join Date
    Feb 2006
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you please tell me that RewriteCond?? I am not good at mod_rewrite.

    Thanks
    Do Good Have Good!


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
  •