Results 1 to 7 of 7
  1. #1

    .htaccess subdirectory redirect help

    Looking for some assistance with setting up a redirect in htaccess. I want all requests for http://[www.]domain.com/subdirectory/* to be redirected to the root http://www.domain.com

    Every example I've found tells how to do this with the directory name itself but not all files/URLs within it. If someone tries to request http://domain.com/subdirectory/file.php I want that to be automatically redirected as well. I'm not finding how to do this and any help would be appreciated...

  2. #2
    Join Date
    Jan 2008
    Location
    Temecula, CA
    Posts
    52
    Why can't you put this redirect in the public_html directory?

  3. #3
    That's what I'm trying to do...

  4. #4
    Join Date
    Jan 2008
    Location
    Temecula, CA
    Posts
    52
    Rewriterule ^subdirectory/(.*)$ http://www.domain.com/$1 [R=301,L]

  5. #5
    Quote Originally Posted by sKunKbad View Post
    Rewriterule ^subdirectory/(.*)$ http://www.domain.com/$1 [R=301,L]
    That doesn't seem to be doing the trick...it's pulling up the pages/files as requested...

  6. #6
    Join Date
    Jan 2008
    Location
    Temecula, CA
    Posts
    52
    I think you need another slash:

    Rewriterule ^/subdirectory/(.*)$ http://www.domain.com/$1 [R=301,L]

    If that doesn't work, you should post your .htaccess(s)

  7. #7
    Quote Originally Posted by sKunKbad View Post
    I think you need another slash:

    Rewriterule ^/subdirectory/(.*)$ http://www.domain.com/$1 [R=301,L]

    If that doesn't work, you should post your .htaccess(s)
    That still didn't do it - when I typed in www.domain.com/subdirectory it automatically went to www.domain.com/subdirectory/

    I don't have anything else in the htaccess.

Similar Threads

  1. Excluding a subdirectory from htaccess rules?
    By emills01 in forum Hosting Software and Control Panels
    Replies: 2
    Last Post: 11-13-2007, 12:05 AM
  2. How to use .htaccess to remove subdirectory...
    By WebTrooper in forum Hosting Security and Technology
    Replies: 1
    Last Post: 04-08-2007, 07:02 AM
  3. .htaccess root vs subdirectory issue
    By ony101 in forum Hosting Security and Technology
    Replies: 2
    Last Post: 05-11-2005, 06:48 AM
  4. how to redirect error 404 page in root and its subdirectory?
    By charts in forum Hosting Security and Technology
    Replies: 2
    Last Post: 10-18-2004, 06:23 PM
  5. Need .htaccess help to block specific domains from subdirectory
    By Deb Suran in forum Hosting Security and Technology
    Replies: 12
    Last Post: 05-02-2002, 08:20 AM

Posting Permissions

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