Easy solution to url rewriting problems

Discussion in 'Apache' started by nullbit, Feb 23, 2005.

  1. #1
    I found this interesting (from apache's mod_rewrite engine manual):

    So basically, you can use external scripts in whatever language you prefer to help rewrite your URLs, which is good for more complex URL rewriting scenarios, when you haven't got the time to learn how to do everything natively using the module.
     
    nullbit, Feb 23, 2005 IP
  2. neterslandreau

    neterslandreau Peon

    Messages:
    279
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    That is pretty neat. Thanks for pointing it out.
     
    neterslandreau, Feb 23, 2005 IP
  3. itsmani1

    itsmani1 Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    here is the link of the site where i m trying to implement url rewrite

    http://www.artologics.com/posters/index.php

    now problem to me when i write this url

    I wanted:

    http://www.artologics.com/posters/catid/38

    to be interpreted server side to mean this:

    http://www.artologics.com/posters/index.php?catid=38


    However, for the first link http://mannan.zabvision.edu.pk /catid/38, since the /catid/38 folders did not really exisit on the server. So I added the following code on my .htaccess file.

    what i want system to do is : it should not replace the url (url that shuld remain same) but system should work as it is working :::

    here is my .htaccess

    RewriteEngine on
    RewriteRule ^catid/([0-9]+)$ /posters/index.php?catid=$1 [R]
    ReWriteRule ^pag/([a-z]+)$ /posters/index.php?pag=$1 [R]
    ReWriteRule ^pag/css/([a-z]+.[a-z]+)$ /posters/css/$1 [R]
    ReWriteRule ^pag/images/([a-z]+_[0-9]+.jpg)$ /posters/images/$1 [R]
    ReWriteRule ^/catid/uploads/([a-z]+.jpg)$ /posters/uploads/$1 [R]
    ReWriteRule ^catid/css/([a-z]+.[a-z]+)$ /posters/css/$1 [R]
    ReWriteRule ^catid/images/([a-z]+_[0-9]+.jpg)$ /posters/images/$1 [R]
    ReWriteRule ^/catid/uploads/([a-z]+.jpg)$ /posters/uploads/$1 [R]
    RewriteRule ^subcat/([0-9]+)$ /posters/index.php?catid=$1 [R]
    ReWriteRule ^subcat/css/([a-z]+.[a-z]+)$ /posters/css/$1 [R]
    ReWriteRule ^subcat/images/([a-z]+_[0-9]+.jpg)$ /posters/images/$1 [R]
    ReWriteRule ^/subcat/uploads/([a-z]+.jpg)$ /posters/uploads/$1 [R]

    can any one help
     
    itsmani1, Mar 18, 2005 IP
  4. itsmani1

    itsmani1 Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Use this.its correct
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule www/(.*)/(.*)/$ mannan.zabvision.edu.pk?$1=$2
    -------------------------
    mannan.zabvision.edu.pk?id=5/www/id/5/
    for
    mannan.zabvision.edu.pk?id=5

    ----------------------------
     
    itsmani1, Dec 18, 2005 IP
  5. itsmani1

    itsmani1 Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i can help in mod_rewire issue.
    ppl can contact me.
     
    itsmani1, Dec 18, 2005 IP
  6. itsmani1

    itsmani1 Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thanx for every thing pplz.
     
    itsmani1, Dec 18, 2005 IP