SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ISAPI doesn't redirect

    hi,

    could someone please give me a hand and have a small look?
    where am I wrong?

    url:
    http://mydomain.com/tool/apps/

    ISAPI rewrtie rule:
    RewriteRule ^/tool/apps(.*)$ /apps$1 [NC,L,R=301]

    result:
    http://mydomain.com/tool/apps/

    expected result:
    http://mydomain.com/apps/


    Thanks a bulk

    as can be viewed here:

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,067
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Try removing the leading slash in front of /tools:

    Code:
    RewriteRule ^tool/apps(.*)$ /apps$1 [NC,L,R=301]
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

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

  3. #3
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it helped in the sandbox, but not on the server itself.

    what's the difference between:

    RewriteRule ^/tool/apps(.*)$ /apps$1 [NC,L,R=301]
    RewriteRule ^\/tool/apps(.*)$ /apps$1 [NC,L,R=301]
    RewriteRule ^tool/apps(.*)$ /apps$1 [NC,L,R=301]
    ?

  4. #4
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,067
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    On some servers you need the / , on others you don't, depending on the version of ISAPI_Rewrite.
    \/ is (normally, not sure about ISAPI_Rewrite) just another way to write / (where \ means: take the next character literally)

    By the way, on some servers it takes a while before changes to that file take effect. You may want to contact your hoster.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

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

  5. #5
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    10x.

  6. #6
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,067
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by elad2109 View Post
    10x.
    huh?
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

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

  7. #7
    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)
    elad,

    Apache 1.x required a leading / in the DocumentRoot's .htaccess mod_rewrite directives; Apache 2.x KNOWS that the / is in the URL (not the URI) so it's effectively prohibited. The result is:
    Code:
    # Apache 1.x
    RewriteRule ^/{regex}$ {redirection} {optional flags}
    # Apache 2.x
    RewriteRule ^{regex}$ {redirection} {optional flags}
    # Apache 1.x OR Apache 2.x
    RewriteRule ^/?{regex}$ {redirection} {optional flags}
    Making the leading / optional covers both cases.

    As for \/, are you kidding? You do not escape the directory separator in regex or the redirection.

    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

  8. #8
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,067
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    ^ Same holds for ISAPI_Rewrite (IIS)
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

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


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
  •