Posted By

lfatr on 02/16/10


Tagged

redirect


Versions (?)

PHP REDIRECT DOMAIN INCLUDING SUBS & ARGUMENTS


 / Published in: PHP
 

I used this as an include on every page to redirect every page incl arguments from .com to .de

  1. // redirects -------------------------------------------------------------------------------------------------------------
  2. $page = new page;
  3. $new_url = str_replace("www.domain.com", "www.domain.de", $page->page, $count);
  4. if ( $count >= 1 ) { $page->redirect($new_url); }
  5. // redirects end ---------------------------------------------------------------------------------------------------------
  6.  
  7. class page {
  8. var $page;
  9. function page() {
  10. $this->page = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
  11. }
  12.  
  13. function redirect($href) {
  14. header("location: ".$href);
  15. exit();
  16. }
  17. }

Report this snippet  

You need to login to post a comment.