Jump to content


Mod_rewrite: working with voodoo

  • Please log in to reply
1 reply to this topic

#1 brittny85

  • Members
  • PipPip
  • Member
  • 23 posts
  • LocationUtah

Posted 07 July 2006 - 08:03 PM

The more I try to work with this the more I agree with what it says at the beginning of the Apache manual mod_rewrite article about it being voodoo- cool voodoo- but still voodoo.  I thought I understood it, but since it isn't working, I must not be as close as I thought.  I'm trying to transfer a website from mostly being .htm files to being to all being .php files.  After looking at lots of different docs I came up with this for my .htaccess file:
LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c
Options +FollowSymLinks 

RewriteEngine on
RewriteRule ^.+(\.htm)$ $.php [R=301,L]

For awhile I somehow had it so that it would redirect all of my .css files to .php (that was fun... not) but it never seems to do the same thing for the only file type that I thought I was specifying- .htm.  Any help would be greatly appreciated!


#2 number9dream

  • Members
  • PipPip
  • Member
  • 16 posts

Posted 23 July 2006 - 02:33 PM

Why don't you just parse the htm files for PHP and leave the URLs as they are?

AddHandler application/x-httpd-php htm

You might need to adapt this slightly depending on your server config.

Remember that Cool URIs Don't Change ;)

Or, failing that, something like the below would probably do the trick:

RewriteRule (.*).htm$ /$1.php

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users