I have a quick question for programmers or server admins

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Persius
    Tap into MOBILE!
    • Jul 2003
    • 11779

    #1

    I have a quick question for programmers or server admins

    Let say I want to make a rule in htaccess that when a user types mydomain.com/xxxxxxx
    it will redirect them to another site otherdomain.com/folder/xxxxxxx/folder...

    so basically its taking what they put after the url and inserting it in another url that it will redirect them to.

    what's the best way to go about this? thanks in advance
    Last edited by Persius; 05-27-2011, 04:41 PM.
  • woj
    <&(©¿©)&>
    • Jul 2002
    • 47882

    #2
    Mod Rewrite FTW

    icq: 33375924 I'll hook it up for you for a few bucks
    Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
    Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
    Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

    Comment

    • CYF
      Coupon Guru
      • Mar 2009
      • 10973

      #3
      Redirect /folder http://www.example.com/newfolder
      Webmaster Coupons Coupons and discounts for hosting, domains, SSL Certs, and more!
      AmeriNOC Coupons | Certified Hosting Coupons | Hosting Coupons | Domain Name Coupons

      Comment

      • Persius
        Tap into MOBILE!
        • Jul 2003
        • 11779

        #4
        to clarify

        the xxxxxxx = different each time (username)

        Comment

        • Juicy D. Links
          So Fucking Banned
          • Apr 2001
          • 122992

          #5
          kuniiiiiiiiiiiiiiiiiiiiiii

          Comment

          • onwebcam
            Fake Nick 1.0
            • Oct 2005
            • 27689

            #6
            301 redirect
            http://www.webconfs.com/how-to-redirect-a-webpage.php
            PLEASE WAIT WHILE BIDEN ADMIN UNINSTALLS ITSELF.....
            ██████████████████▒ 99.5% complete.

            Comment

            • VIPimp
              Marina WILL have my babies!
              • May 2003
              • 9234

              #7
              He's not trying to do a regular redirect... he wants the the id in the url to carry over within the url it will be redirected to.

              Comment

              • CYF
                Coupon Guru
                • Mar 2009
                • 10973

                #8
                Originally posted by Persius
                to clarify

                the xxxxxxx = different each time (username)
                you'll need some PHP for that.
                Webmaster Coupons Coupons and discounts for hosting, domains, SSL Certs, and more!
                AmeriNOC Coupons | Certified Hosting Coupons | Hosting Coupons | Domain Name Coupons

                Comment

                • react
                  Confirmed User
                  • Sep 2003
                  • 673

                  #9
                  Can be done with mod_rewrite exclusively.
                  --
                  react

                  Comment

                  • fris
                    Too lazy to set a custom title
                    • Aug 2002
                    • 55679

                    #10
                    maybe something like this?

                    Code:
                    Options +FollowSymLinks
                    RewriteEngine On
                    RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
                    RewriteRule ^([a-z0-9]+)$ http://otherdomain.com/folder/$1/folder [NC,R=301,L]
                    (removes www from domain, not really needed)
                    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                    Comment

                    • VIPimp
                      Marina WILL have my babies!
                      • May 2003
                      • 9234

                      #11
                      Originally posted by fris
                      maybe something like this?

                      Code:
                      Options +FollowSymLinks
                      RewriteEngine On
                      RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
                      RewriteRule ^([a-z0-9]+)$ http://otherdomain.com/folder/$1/folder [NC,R=301,L]
                      (removes www from domain, not really needed)
                      Thank you Fris, EXACTLY what we were looking for... BUT do you know how we can make it work if the variable also has dashes in it.
                      This does not work if its something like domain.com/xx-xxxx-xxxxx ...we need it to work in both situations.

                      Comment

                      • Barry-xlovecam
                        It's 42
                        • Jun 2010
                        • 18083

                        #12
                        Code:
                        RedirectMatch 301 ^/(.*)$ http://static.askapache.com/$1

                        Comment

                        • VIPimp
                          Marina WILL have my babies!
                          • May 2003
                          • 9234

                          #13
                          Originally posted by Barry-xlovecam
                          Code:
                          RedirectMatch 301 ^/(.*)$ http://static.askapache.com/$1
                          thanks that worked too but it also redirects the typeins to the domain that dont have anything after .com/

                          I got Fris's code to work by adding a - after the 9 in the rewrite rule... RewriteRule ^([a-z0-9-]+)


                          do you know what line I should put if I want the regular typeins redirected to a whole other site such as just www.yahoo.com ?

                          Comment

                          • Tempest
                            Too lazy to set a custom title
                            • May 2004
                            • 10217

                            #14
                            Originally posted by VIPimp
                            thanks that worked too but it also redirects the typeins to the domain that dont have anything after .com/

                            I got Fris's code to work by adding a - after the 9 in the rewrite rule... RewriteRule ^([a-z0-9-]+)


                            do you know what line I should put if I want the regular typeins redirected to a whole other site such as just www.yahoo.com ?
                            Code:
                            RedirectMatch 301 ^/*$ http://www.yahoo.com/
                            RedirectMatch 301 ^/(.*)$ http://static.askapache.com/$1

                            Comment

                            • fris
                              Too lazy to set a custom title
                              • Aug 2002
                              • 55679

                              #15
                              Originally posted by VIPimp
                              thanks that worked too but it also redirects the typeins to the domain that dont have anything after .com/

                              I got Fris's code to work by adding a - after the 9 in the rewrite rule... RewriteRule ^([a-z0-9-]+)


                              do you know what line I should put if I want the regular typeins redirected to a whole other site such as just www.yahoo.com ?
                              how are you detecting typins?
                              Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                              Comment

                              Working...