[thelist] mod_rewrite help

Burhan Khalid thelist at meidomus.com
Tue Sep 23 07:19:08 CDT 2003


Greetings guys :

   Have a bit of a headache with a mod_rewite rule and am hoping some 
masters of the dark arts can help me out. First, the mod_rewrite rule :

  # Rewrite URLs of the form 'index.php?q=x':
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

   This rule works great. The problem comes when I try to redirect an 
old URL to the new (mod rewritten) URL. I set up this redirect in my 
configs :

   Redirect permanent /archives/000059.php http://www.domain.com/node/view/3

   The www.domain.com/node/view/3 is the new mod_rewritten URL.

   However, when I type http://www.domain.com/archives/000059.php in a 
browser, I get redirected to 
http://www.domain.com/node/view/3?q=archives/0000059.php (which ofcourse 
isn't a valid URL), so the site just pops back to the index page.

   Is there some way to get this to work? I found a temporary solution. 
  I changed the redirect rule so that it redirects to the "pre" 
mod_rewrite URL. However, doing that, the mod_rewrite engine doesn't 
kick in, and I get domain.com/index.php?q=node/view/3 in the browser.

   Help save my hair :(
-- 
Burhan Khalid
thelist[at]meidomus[dot]com
http://www.meidomus.com



More information about the thelist mailing list