SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2009
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    apache redirect to block selective paths

    Hi

    I have a drupal site example.com and there are many subsections like
    example.com/noname
    example.com/dummy
    example.com/another

    now I want to enable access to example.com/dummy only
    and if user types in example.com they get redirected to example.com/dummy
    and all other paths are also denied.

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

    Is there a question in that? More important (to me), what have you tried to perform whatever it is in your question?

    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

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2009
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry didn't explained the question

    RewriteCond %{QUERY_STRING} !(^|&)q=foobar(/|&|$) [NC]
    RewriteCond %{REMOTE_ADDR} !^192\.168
    RewriteRule .* - [F]
    I want to enable access to foobar from any IP but to access other query string user must be in 192.168 network.

    I did above and it worked but now outside users can't see images on web page.
    what I am doing wrong here?

  4. #4
    SitePoint Enthusiast
    Join Date
    Feb 2009
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have fixed above issue . the problem was in flag. in another rule there was L flag. I changed it to C and everything worked.

    another issue I noticed is that when somebody goes to example.com they can see the page but everything else except example.com/foobar is not working.

    how I can disable access to example.com but keep access to example.com/foobar


    thanks.

  5. #5
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    8,894
    Mentioned
    138 Post(s)
    Tagged
    2 Thread(s)
    Add it as a condition

    Code:
    RewriteCond %{QUERY_STRING} !(^|&)q=foobar(/|&|$) [NC]
    RewriteCond %{REQUEST_URI} !^/foobar
    RewriteCond %{REMOTE_ADDR} !^192\.168 
    RewriteRule .* - [F]
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  6. #6
    SitePoint Enthusiast
    Join Date
    Feb 2009
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks.

    mod_rewrite is a beast. reading tutorials to know it better.


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
  •