Forum Moderators: phranque
My question: I am trying to keep URL structure as consistent as possible, so "something.com/one-two.html" is now "something.com/one-two/"
I am using:
RewriteRule ^([^.]+)\.html$ http://www.example.com/$1/ [R=301,L]
to do this. It appears to be working. Is this kosher? But, it only works when I have the old .html file on server. Is that standard practice, I--naively, maybe--thought I could just do 301s in the htaccess file and leave the old .html files to vanish into thin air. Do I need to keep the old HTML files on server? Then once the rewrites have taken effect, remove them?
Or is there another method of rewriting that I can use that will work on non-existent files.
[edited by: jdMorgan at 2:51 am (utc) on Jan. 8, 2010]
[edit reason] example.com [/edit]
So look for other rules ahead of this one that check for file- and/or directory-exists -- i.e. lines starting with
RewriteCond %{REQUEST_FILENAME} . If there are none, then perhaps you have content-negotiation enabled, and its grabbing the request because you've used "directory-naming syntax" for your new URLs (they end with a slash and are therefore presumed to be directories, not files.) If this is the case, then adding
Options -MultiViews Jim