SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to rewrite two variable

    hii here is the url which i want to rewrite

    index.php??a=cust&page=banners

    in html format
    i don't how to rewrite two variable url and what give in exact url file

    please tell me

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Is this question about mod_rewrite? whereby people access a web address like:

    <website>/cust/banners

    but behind the scenes it actually retrieves data from:

    <website>/index.php?a=cust&page=banners

  3. #3
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but how to write in .htaccess for rewriting
    for example : for one query i do like this
    RewriteRule ^(.*).htm index.php?a=$1 [L,QSA]

    what will be for passing two ?

  4. #4
    SitePoint Zealot RishikeshJha's Avatar
    Join Date
    Mar 2009
    Location
    INDIA
    Posts
    146
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by realcoder View Post
    but how to write in .htaccess for rewriting
    for example : for one query i do like this
    RewriteRule ^(.*).htm index.php?a=$1 [L,QSA]

    what will be for passing two ?
    use $2 for second variable
    Rishi

  5. #5
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i know but m confuse how to write first part as in one variable i use this ^(.*).htm

    what will be for both

  6. #6
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    As a very crude example:

    Code:
    Options +FollowSymLinks
    RewriteEngine On
    RewriteRule ^(.*)/(.*)\.html$ index.php?a=$1&cust$b [L,R=301]
    It's better to different atoms than (.*) though, but since I have no idea what values a and cust can take I put those in for now.
    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
  •