htaccess / mod rewrite

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • philiplikens
    Junior Member
    • Jul 2004
    • 5

    #1

    htaccess / mod rewrite

    Code:
    RewriteEngine on
    RewriteRule !\.(gif|jpg|png|css)$ /home/swc/public_html/index.php
    that's my code. i have an index.php file in my root directory. i also put the .htaccess file that contains the above code in the same directory. all i'm wanting is for any request for a php or html/htm file go to index.php in the root directory. from there i can handle all the info. i've put this all on the server but i can't seem to get things to work.

    if you would like to test:


    and i would like the above to simply forward to:


    any help is greatly appreciated. i searched the old htaccess topics on this forum and nothing seemed to work for me. do i need to install the files somehow?
  • Buddha
    Senior Member
    • Mar 2004
    • 825

    #2
    Your rewriting a url not a path. /home/swc/public_html/index.php this looks like your path. Try something like this:

    Code:
    RewriteEngine on
    RewriteRule !\.(gif|jpg|png|css)$ index.php
    "Whatcha mean I shouldn't be rude to my clients?! If you want polite then there will be a substantial fee increase." - Buddha

    Comment

    • philiplikens
      Junior Member
      • Jul 2004
      • 5

      #3
      thanks for your help.

      i tried what you said and got no love. i'm leaving right now for the weekend but i'll check back here sunday or monday and work on it more then. do i need to set special permissions for any of the files or anything?

      thanks.

      Comment

      • philiplikens
        Junior Member
        • Jul 2004
        • 5

        #4
        back.

        i tried what was mentioned above...and i tried changing the file permissions to 775...i'm not sure what else to do. if any one has any ideas i'm open to them.

        thanks so much for your help.

        Comment

        • Buddha
          Senior Member
          • Mar 2004
          • 825

          #5
          Might try this:

          Code:
          RewriteEngine on
          RewriteRule !\.(gif|jpg|png|css)$ /index.php
          I'm always forgeting the slash.
          "Whatcha mean I shouldn't be rude to my clients?! If you want polite then there will be a substantial fee increase." - Buddha

          Comment

          • philiplikens
            Junior Member
            • Jul 2004
            • 5

            #6
            still no love. i would think this should be easy.

            i'm getting a 500 Internal Server Error if that helps.

            Comment

            • -Oz-
              Senior Member
              • Mar 2004
              • 545

              #7
              modrewrite is never easy
              Dan Blomberg

              Comment

              • mkraai
                Junior Member
                • Mar 2004
                • 21

                #8
                "Custom error pages" instead?

                I've used the "custom error pages" (ErrorDocument) mechanism for similar purposes. Check out this article: http://www.onlamp.com/pub/a/onlamp/2...avidsklar.html
                “Make everything as simple as possible, but not simpler.”
                — Albert Einstein

                “A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away.”
                — Antoine de Saint-Exupéry

                Comment

                • philiplikens
                  Junior Member
                  • Jul 2004
                  • 5

                  #9
                  Code:
                  RewriteEngine on
                  RewriteRule !(css) index.php
                  that works. i'll have to play with it some more but i finally got something to work! thanks for everyone's suggestions.

                  mkraai - thanks for the link. i'll check it out.

                  Comment

                  Working...