mod_rewrite and php as a CGI

Discussion in 'Server Operation' started by H0unter, Dec 30, 2006.

  1. H0unter

    H0unter New Member

    Hello everybody!! :D!!

    How r u????

    Ive just arrived :D!! my first post :cool: :cool:!!

    Hope u can help me!!

    I have a hostinga nd im using a php as a cgi , i have problems with a mod_rewrite , dont work :S! dont know why :S!! im a little noob in this thing , ive heart that rewrite is diferents when php is installed as a CGI , can give me a hand?? please!

    RewriteEngine on
    RewriteBase /

    RewriteRule ^show\.php/(.*)$ show2.php?img=$1 [L]
    RewriteRule ^out\.php/([a-z]{1})(.*)$ out2.php?$1=$2 [L]
    RewriteRule ^view\.php/(.*)$ view2.php?img=$1 [L]
    RewriteRule ^image\.php/([a-z]{1})(.*)$ images2.php?$1=$2 [L]
    RewriteRule ^gallery/([0-9]+)-([^/]*)/(.*)$ gallery.php?gal=$1&img=$3 [L]
    RewriteRule ^view/([0-9]+)-([^/]*)/(.*)$ gallery_body.php?gal=$1&img=$3 [L]

    Here is the httacces!!

    Thanks for your time and help!!

    PSD: im peruvian and dont speak english T_T!! sorry if u cant undertand me veru wel T_T!!

    Cyas

    Att
    Hounter
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What exactly doesn't work? Any error messages? Any errors in Apache's error log?
     
  3. H0unter

    H0unter New Member

  4. falko

    falko Super Moderator Howtoforge Staff

    You could use something like this:

    Code:
    <IfModule mod_rewrite.c>
     RewriteEngine on
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule ^(.*)$ /out2.php?i=$1 [L,QSA]
    </IfModule>
    You'd then use
    http://www.imagehost123.uni.cc/out.php/32_presidente6zw.jpg instead of http://www.imagehost123.uni.cc/out.php/i32_presidente6zw.jpg, and it would get converted to http://www.imagehost123.uni.cc/out2.php?i=32_presidente6zw.jpg.
     
  5. H0unter

    H0unter New Member

    :O alots of thanks ,

    But im noob T_T! the code that u posted , u have to put it in a httacces?

    thanks again

    Att

    Hounter
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Yes, put it into an .htaccess file (and remove everything else from it).
     

Share This Page