Htaccess url rewrite help please

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Htaccess url rewrite help please

    My pages have urls like:
    Code:
    cows.com/?go=cowdung
    i want to use htaccess and in such a way that,
    when a user types into his/her web browser :

    Code:
    cows.com/cowdung
    htaccess uses the mod-rewrite(rewriterule) and takes the user to:
    Code:
    cows.com/?go=cowdung
    CAN THIS BE DONE? if yes, then please someone write me the htaccess code please. I have no idea how to use the htaccess. Please help.Just in case:"the cows.com domain does NOT BELONG to me, i just used it as an example."
    Thanks in advance.:-)

    Added after 8 minutes:

    And it cant just be for
    Code:
    cows.com/cowdung
    
    becomes>>
    
    cows.com/?go=cowdung
    it has to work for any value.like

    Code:
    cows.com/anything
    
    becomes>>
    
    cows.com/?go=anything
    CAN THIS BE DONE? if yes, then please someone write me the htaccess code please.
    Last edited by Sifat3d; 02.11.11, 14:39.

    #2
    Rewrite cows.com/(.*)^ $cows.com/$1
    Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
    Visit: WapMasterz Coming Back Soon!
    _______
    SCRIPTS FOR SALE BY SUBZERO
    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
    _______
    Info & Tips
    php.net
    w3schools.com

    Comment


      #3
      Int. Server error

      Doesnt work:-(
      Code:
      Rewrite cows.com/(.*)^
      $cows.com/$1
      My whole site becomes unavailable and says:
      500 internal server error. The server encountered an internal error or misconfig . . . . . .
      My server is Apache-1.3.27 is this due to the backdated server?

      Comment


        #4
        RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
        RewriteCond %{HTTP_HOST} !^$
        RewriteRule ^/(.*) http://www.example.com/$1 [L,R]
        Try this one
        Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
        Visit: WapMasterz Coming Back Soon!
        _______
        SCRIPTS FOR SALE BY SUBZERO
        Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
        FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
        _______
        Info & Tips
        php.net
        w3schools.com

        Comment


          #5
          There should be something after the cow.com like example : cow.com/cowdung => cow.com/page.php?go=cowdung
          Code:
          RewriteRule ^cow\.com\/(.+)$ /page.php?go=$1 [L,NC,QSA]
          Note that,for it to work easier for U,U have to provide the page name ,thus the page.php

          The L means LAST ,which ends that particular RewriteRule,
          the NC means NO CASE that is,it should work no matter the case of the characters(capital or small characters)
          The QSA means Query String Append means the url is having a query request (that is : ?go=blahblahblah)

          Example of a site of rewrite Rules is : http://adrazz.net :D

          Comment


            #6
            Options +Indexes
            Options +FollowSymlinks
            RewriteEngine on
            RewriteBase /
            RewriteRule \/(.*?)$ index.php?go=$1

            if your page not automaticaly redirected to new URL, add this code to your index.php
            Code:
            if(isset($_GET["go"]) && strstr($_SERVER["REQUEST_URI"], '?')) {
            echo '<meta http-equiv="refresh" content="0; url=http://yourdomain/'.$_GET["go"].'">';
            // or use php header location to redirect
            exit;
            }

            Comment


              #7
              Thanks. razbee bro gave me simpler solution.:-)

              Thanks to ogah, thanks to razzbee, thanks to subzero. All of u were a lot of help. :-)

              Comment


                #8
                :D U are welcome,just click thanx.....

                Comment


                  #9
                  No thanks button in mobile :-( i browse the net 4m mobile with limited bandwidth.

                  Comment

                  Working...
                  X