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 8 of 8
  1. #1
    New Coder
    Join Date
    Mar 2006
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    redirect an entire subdirectory?

    i'm dealing with asp pages on a IIS server so, using the lovely .htaccess is out of the question.

    i also don't have root level access to the Internet Services Manager and i was trying to avoid having to go into each and every single page within the directory to add redirect code.

    has anyone done this before? any advice is greatly appreciated.

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Since you don't have the 'administrative' access that you need to do this, you can simply change the index.asp file to do the redirect.

    If you have other pages that can be manually navigated (i.e., no security checking on your pages), you may have to do this on every single page.

    My suggestion: FIND AND REPLACE. Find something that is in every page (<html> for example) and replace it with <% response.redirect("/path/to/folder/") %><html>.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Move all the files that are there somewhere else so they get a 404.
    Use a custom 404 page to redirect.

    If you only use index.asp, it won't trap bookmarked pages or old links and users will still see them.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #4
    New Coder
    Join Date
    Mar 2006
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    do i have to have access to the Internet Services Manager to customize and set a 404 page?

    Quote Originally Posted by nikkiH View Post
    Move all the files that are there somewhere else so they get a 404.
    Use a custom 404 page to redirect.

    If you only use index.asp, it won't trap bookmarked pages or old links and users will still see them.

  • #5
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Yes, which is why I didn't suggest that at the beginning ( nikki ).

    Custom Error pages ( done in IIS under WebSite > Properties > Custom Error Pages ) require access to the site in IIS.

    Since you said you didn't have access to IIS, this became a moot point.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #6
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Custom Error pages ( done in IIS under WebSite > Properties > Custom Error Pages ) require access to the site in IIS.
    Good to know.
    I've always had those already set up.
    If I didn't, I'd sure be pestering the admin / host to set that up. I think those are important.

    But just changing index.asp won't affect all the other pages in the site, and bookmarks and old links won't redirect.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #7
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    You are correct that just changing the index.asp >> redirect will not fix things like bookmarks and other pages, which is why I said to use FIND AND REPLACE.

    Since I do mostly secure pages, I use multiple checks and balances so I can use the index.asp >> redirect (i.e. IF (you can't pass my security checks) THEN redirect to INDEX) END IF, INDEX >> REDIRECT Another Page).
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #8
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Very cool.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/


  •  

    Posting Permissions

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