We are moving from one site language/CMS (coldfusion/custom) to another (PHP/Drupal) and need to have some of our old pages redirected to new ones. I have access to both the .htaccess and httpd.conf (and apache2.conf) as this is a vps on Linode.
Most of them cannot be done via regular expression (they contain GUIDs in the URL) and we're ok writing static redirects.
Here's an example:
RewriteRule /show.cfm/FG3f4-30F1G/ http://www.mysite.com/john-smith [R=301]
that's it...I've tried the syntax with the starting caret ^, ending dollar sign, none of it seems to work.
I may have a misunderstanding as to what role the RewriteCond plays -- there are other lines already in the .htaccess.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Do I need to re-declare the RewriteCond once the RewriteRule is specified?
Also -- Ideally, to preserve cleanliness in the .htaccess, I would like to use a RewriteMap, where I can specify one text file and just have two tab-delimited columns of "old url | new url"...but I can't get that to work either (if it's even appropriate to use).
Any ideas would be MOST welcome...
For your first static example you would be better off using the Redirect directive rather than mod_rewrites RedirectRule.
A RewriteCond only applies to the RewriteRule that directly follows it. So in your OP the conds states if the requested URI is not a real file or directoruy and it's not the favicon, then redirect it to index.php
With regards to you attempting it with the carat and it not working, this is likely a paths issue and the exact solution depends on whether the RewriteRule is located in the httpd.conf file or in the .htaccess. As a generally rules patterns you are matching in httpd.conf will be preceeded by a forward slash, wheras ones you are matching against in a .htaccess file will not.