We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • I’m attempting to have all old URL’s on a site a redesigned be forwarded to the new URL’s I created via MODx, and am having problems authoring the proper RewriteRule to do it. I tried the following, but this didn’t work, rendering my pages without a stylesheet. Anyone familiar with a way to redirect all .php files to .html without affecting the MODx RewriteRule required for friendly URL’s?

    Here’s the rule I was trying to implement (excuse my poor RegEx knowledge)...

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^(.*)\.php$ index.php?q=$1 [L,QSA]
    
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    
      • 33496
      • 19 Posts
      Try this. I was out partying last night, so I need to have another look at this later today I guess smiley
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      
      RewriteCond %{REQUEST_URI} !^/index.php$
      RewriteRule ^(.*)\.php$ /$1.html [L]
      
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
      

      This should rewrite all .php requests except to /index.php to .html and then taken care of by MODx by index.php.
        Johnny Chadda
        http://johnny.chadda.se
        "This is a UNIX virus. Please remove all your files and copy this message to friends."