Apache Mod_Rewrite help needed.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acctman
    Confirmed User
    • Oct 2003
    • 2840

    #1

    Apache Mod_Rewrite help needed.

    i'm trying to make the default user profiles url http://www.qwerty.com/profile.php?user=john appear as http://www.qwerty.com/john and also be able to use http://www.qwerty.com/john/ with the slash. i want this for all users

    i've tried a few rewrites and ended up just blocking the site
    Last edited by acctman; 02-08-2005, 11:01 AM.
  • rickholio
    Confirmed User
    • Jan 2004
    • 1914

    #2
    Originally posted by acctman
    i'm trying to make the default user profiles url http://www.qwerty.com/profile.php?user=john appear as http://www.qwerty.com/john and also be able to use http://www.qwerty.com/john/ with the slash. i want this for all users

    i've tried a few rewrites and ended up just blocking the site
    So what are you trying to do here, exactly... push a user from profile.php?user=blah to /blah? If so, just use a

    header("Location: http://www.qwerty.com/$_GET[user]")

    or similar in your php page.

    If you're trying to map /john (or /john/) to profile.php?user=john, that gets a little more interesting, because then ANY subdirectory would have to be considered a profile request. Is that what you're after?
    ~

    Comment

    • acctman
      Confirmed User
      • Oct 2003
      • 2840

      #3
      i want users to be able to type in http://www.qwerty.com/UserName/ or http://www.qwerty.com/UserName and pull up there account http://www.qwerty.com/profile.php?user=UserName

      Comment

      • pornRefinery
        Confirmed User
        • Jan 2005
        • 384

        #4
        RewriteEngine on
        RewriteRule ^/p/([^/]+) /profile.php?user=$1

        Will redirect domain.com/p/john to the page you want. It's better to do it under /p/ or any other name you choose as opposed to the root dir.

        Comment

        • acctman
          Confirmed User
          • Oct 2003
          • 2840

          #5
          Originally posted by pornRefinery
          RewriteEngine on
          RewriteRule ^/p/([^/]+) /profile.php?user=$1

          Will redirect domain.com/p/john to the page you want. It's better to do it under /p/ or any other name you choose as opposed to the root dir.

          i see you point, cause if a user makes and account called images and the redirect is on the root i'll be fucked or atleast the redirect would get confused.

          but is there a way around that? cause http://www.domain.com/UserName is so much cleaner looking and easier for a user to remember and tell someone
          Last edited by acctman; 02-08-2005, 11:33 AM.

          Comment

          • acctman
            Confirmed User
            • Oct 2003
            • 2840

            #6
            Originally posted by pornRefinery
            RewriteEngine on
            RewriteRule ^/p/([^/]+) /profile.php?user=$1

            Will redirect domain.com/p/john to the page you want. It's better to do it under /p/ or any other name you choose as opposed to the root dir.
            hmm that didn't work

            Comment

            • Jayo
              Confirmed User
              • Jan 2005
              • 854

              #7
              try this:
              Options +FollowSymLinks
              RewriteEngine on
              RewriteRule profile/(.*)/(.*)/$ /profile.php?$1=$2

              RewriteEngine on
              RewriteRule profile/(.*)/(.*)/?$ /profile.php?$1=$2
              SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, you may use a 624x80 instead of a 120x60. Let me repeat... A 120 x 60 button and no more that 3 lines of DEFAULT SIZE AND COLOR text.

              Comment

              • acctman
                Confirmed User
                • Oct 2003
                • 2840

                #8
                Originally posted by Jayo
                try this:
                Options +FollowSymLinks
                RewriteEngine on
                RewriteRule profile/(.*)/(.*)/$ /profile.php?$1=$2

                RewriteEngine on
                RewriteRule profile/(.*)/(.*)/?$ /profile.php?$1=$2
                that sort of works, but images aren't loading

                Comment

                • acctman
                  Confirmed User
                  • Oct 2003
                  • 2840

                  #9
                  bump ....

                  Comment

                  • wimpy
                    Confirmed User
                    • Jan 2003
                    • 607

                    #10
                    Originally posted by acctman
                    i see you point, cause if a user makes and account called images and the redirect is on the root i'll be fucked or atleast the redirect would get confused.

                    but is there a way around that? cause http://www.domain.com/UserName is so much cleaner looking and easier for a user to remember and tell someone
                    Just be sure to create your own user login for any dir that you use yourself.
                    Fyodor Dostoyevsky wrote: "Every man has reminiscences which he would not tell to everyone but only his friends. He has other matters in his mind which he would not reveal even to his friends, but only to himself, and that in secret. But there are other things which a man is afraid to tell even to himself, and every decent man has a number of such things stored away in his mind."

                    icq 8243657

                    Comment

                    Working...