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!!


  2. falko

    falko Super Moderator ISPConfig Developer

    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 ISPConfig Developer

    You could use something like this:

    <IfModule mod_rewrite.c>
     RewriteEngine on
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteRule ^(.*)$ /out2.php?i=$1 [L,QSA]
    You'd then use instead of, and it would get converted to
  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


  6. falko

    falko Super Moderator ISPConfig Developer

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

Share This Page