puddlec Posted April 15, 2010 Share Posted April 15, 2010 Just been asked about doing a 301 redirect, due to moving a site to use oscommerce, which of course writes the URL's differently and am wondering what the best method is either use a php file (doing something like this) or use a .htaccess file the amount of URL's that would need to be done is about 72 (i have not got access to the code on the site to be moved, so i cannot do it on that side, so I know i would have to set something up on the new server, once i get the site ready) Phoenix support now at https://phoenixcart.org/forum/ App created for phoenixTinyMCE editor for admin Link to comment Share on other sites More sharing options...
spooks Posted April 15, 2010 Share Posted April 15, 2010 Generally htaccess is the best method. Is there a common rule that could be applied to make the code short? Remember if any pages effected are useing forms with post, post is lost in a redirect. Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
MrPhil Posted April 15, 2010 Share Posted April 15, 2010 If you do an internal rewrite (not a 301 or 302 redirect), are form posts still lost? If not, they could add a redirect function to the top of the application_top.php file. It would look at the current path and file, build a new path (e.g., just /catalog/index.php?query_string without http://sitename) and do a header("Location: " . $new_uri); header("HTTP/1.1 200 Found"); exit(); to it. This has to be done before any output to the browser. I think the same thing can be done with .htaccess, and would be a bit faster. If you need to do a lot of complicated string manipulation, PHP might be easier to work with than .htaccess. This assumes, of course, that the store is on the same domain as before. If you're actually redirecting to another site (301 status), only the initial call to the store (entry) should be redirected -- all internal pages should be using the new store URL and don't get redirected. When you do a 301 or 302 redirect (whether .htaccess or PHP), the browser receives only a notice that the page has moved (the new URL and the status code 301 permanent or 302 temporary). The browser shows the new address and makes a fresh request (GET) to the new address. With an internal rewrite, AFAIK it all stays on the server and control merely is transferred to the new URI. Perhaps you could give us an example or two of an old URL and the new one? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.