Oliver, I've seen this page/technique before, but from the looks of things I cannot send http://www.domain.com/its/index.cfm?doc_id=10 and http://www.domain.com/its/index.cfm?doc_id=20 to different pages due to matching only taking place at the file level... Is this in fact the case?
Thanks, Tim Oliver Rowlands wrote: > Hi Timothy, > > It seems you didn't look hard enough. I suggest you have a look at > Apache's mod_rewrite rewrite maps[1]. I've used them in the past to > migrate sites with 1000's of pages to Typo3. > > Let me know if you want more information on how to set this up. > > Regards, > > Oliver > > [1] http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteMap > > Timothy Patterson wrote: >> We are moving away from a CMS that utilizes URLs in the form of >> "http://www.domain.com/its/index.cfm?doc_id=10" in favor of Typo3. >> >> I have RealURL working perfectly (great job devs!) and I am quite >> satisfied with my setup. >> >> My problem is the fact that I have to keep all of the old URLs valid >> on my site. Due to the 1000s of pages on my site I would like to >> implement a type of redirection database to keep the old URLs valid >> while increasing manageability of the redirections. >> >> After doing some research online, I have found that there is no >> clean-cut way to redirect a URL in the style that our old CMS uses. >> >> Example: >> You can only redirect "http://www.domain.com/its/index.cfm" to any >> URL. You cannot redirect >> "http://www.domain.com/its/index.cfm?doc_id=10" to a URL and >> "http://www.domain.com/its/index.cfm?doc_id=20" to a different URL. >> Catch my drift? "Standard" redirects only allow you to match file >> names and not the parameters after the file name. >> >> My solution was to create a MySQL database, then use a combination of >> mod_rewrite with PHP. >> >> If you view my sample .htaccess file and PHP script below, you can see >> my problem... My setup works great except for the fact that I get a >> ?myredirect=0 appended to every single URL on my site. I've played >> with mod_rewrite for hours to try to get rid of that, but it seems to >> be the only way to avoid an infinite rewriting loop (it is the only >> way I can communicate from the PHP script back to mod_rewrite). I >> really don't want the ?myredirect=0 on every page. >> >> Does anyone have any suggestions? Any better ways of accomplishing >> this goal? Does anyone know of any other mass redirection solutions? >> Any other hybrid PHP / mod_rewrite possibilities? Am I just crazy? >> >> If I can get some help I'd be glad to write up a How-to doc that will >> help others migrating away from a different CMS. >> >> Here is what I have so far... (It works, just adds a ?myredirect=0 to >> every page's url. Grr!) >> >> mod_rewrite (in a .htaccess file): >> RewriteEngine On >> RewriteCond %{QUERY_STRING} !(myredirect) >> RewriteRule .* /redirect.php?dbredirection=%{REQUEST_URI} [L,QSA] >> >> And my PHP code: >> <?php >> // DB Connectivity Include... >> include "config.php"; >> >> // Reads QUERY_STRING environment variable and grabs everything 'after >> // dbredirection=' >> list($junk, $request) = split("dbredirection=", getenv('QUERY_STRING')); >> >> // Replace the first instance of a & with a ? (caused by mod_rewrite) >> $request = preg_replace("/(\&)/", "?", $request, 1); >> >> // Connect to MySQL... >> $connection = mysql_connect($db_host, $db_user, $db_pass); >> mysql_select_db($db); >> >> // Get today's date in MySQL format... >> $expdate = date('Y-m-d'); >> >> // Build Query... >> // Select & Check Expiration - Default is 2050-01-01 so we should be >> ok // with this... >> $query = "SELECT newurl FROM redirects WHERE oldurl='$request' AND >> expires >= '$expdate' LIMIT 1"; >> >> // Execute Query... >> $result = mysql_query($query); >> if(mysql_num_rows($result) != 0) >> { >> // Retrieve Row... >> $row = mysql_fetch_row($result); >> >> //echo "Redirecting to: $row[0]"; >> //die; >> >> // Perform Safe, "Permanent" Redirect... >> header("HTTP/1.1 301 Moved Permanently"); >> header("Location: $row[0]"); >> die; >> } else { >> // No entries exist... Try to go to page... >> // Add ?myredirect=0 to the URL to prevent mod_rewrite loops!!! >> >> // Does $request contain a '?' >> $qmark = strstr($request, '?'); >> if(!$qmark) >> { >> $request .= "?myredirect=0"; >> } else { >> $request .= "&myredirect=0"; >> } >> header("Location: $request"); >> die; >> } >> ?> > > _______________________________________________ TYPO3-english mailing list [email protected] http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
