Witam mianowicie mam problem z przekierowaniem domeny na serwerze.

Domena jak i serwer wykupiony na nazwa.pl

Ale do rzeczy zainstalowałem forum punbb na serwerze.
Wszystko się ładnie ładuje domena się otwiera ale po wybraniu jakiej kolowiek zakładki przekierowuje
na adres serwera.


Zrobiłem na sztywno w .htaccess Redirect oczywiście wszystko działa pod domeną jaką ustawiłem w Redirect ale nie działa w ogóle logowanie i rejestracja.

Wiem że problem jest gdzieś w ustawieniach punbb ale nie mogę znaleźć gdzie.
Widzę że ustawione SERVER_ROOT - więc napewno
.htaccess robi redirecta na domenę a dane pobiera z SERVER_ROOT i stąd odkrycie adresu serwera po przejści na dowolną zakładkę

Domyślny .htaccess

  1. # BEGIN PunBB
  2.  
  3. # ----------------------------------------------------------------------
  4. # Start rewrite engine
  5. # ----------------------------------------------------------------------
  6.  
  7. <IfModule mod_rewrite.c>
  8. # MultiViews interfers with proper rewriting
  9. Options -MultiViews
  10.  
  11. RewriteEngine On
  12.  
  13. # Uncomment and properly set the RewriteBase if the rewrite rules are not working properly
  14. #RewriteBase /
  15.  
  16. RewriteCond %{REQUEST_FILENAME} !-f
  17. RewriteCond %{REQUEST_FILENAME} !-d
  18. RewriteRule . rewrite.php [L]
  19. </IfModule>
  20.  
  21.  
  22. # ----------------------------------------------------------------------
  23. # Better website experience for IE users
  24. # ----------------------------------------------------------------------
  25.  
  26. # Force the latest IE version, in various cases when it may fall back to IE7 mode
  27. # github.com/rails/rails/commit/123eb25#commitcomment-118920
  28. # Use ChromeFrame if it's installed for a better experience for the poor IE folk
  29.  
  30. <IfModule mod_setenvif.c>
  31. <IfModule mod_headers.c>
  32. BrowserMatch MSIE ie
  33. Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
  34. </IfModule>
  35. </IfModule>
  36.  
  37. <IfModule mod_headers.c>
  38. # Because X-UA-Compatible isn't sent to non-IE (to save header bytes),
  39. # We need to inform proxies that content changes based on UA
  40. Header append Vary User-Agent
  41. # Cache control is set only if mod_headers is enabled, so that's unncessary to declare
  42. </IfModule>
  43.  
  44.  
  45. # ----------------------------------------------------------------------
  46. # UTF-8 encoding
  47. # ----------------------------------------------------------------------
  48.  
  49. # Use UTF-8 encoding for anything served text/plain or text/html
  50. AddDefaultCharset utf-8
  51.  
  52. # Force UTF-8 for a number of file formats
  53. AddCharset utf-8 .html .css .js .xml .json .rss
  54.  
  55.  
  56. # ----------------------------------------------------------------------
  57. # A little more security
  58. # ----------------------------------------------------------------------
  59.  
  60. # Do we want to advertise the exact version number of Apache we're running?
  61. # Probably not.
  62. ## This can only be enabled if used in httpd.conf - It will not work in .htaccess
  63. # ServerTokens Prod
  64.  
  65.  
  66. # "-Indexes" will have Apache block users from browsing folders without a default document
  67. # Usually you should leave this activated, because you shouldn't allow everybody to surf through
  68. # every folder on your server (which includes rather private places like CMS system folders).
  69. <IfModule mod_autoindex.c>
  70. Options -Indexes
  71. </IfModule>
  72.  
  73. # END PunBB






a tutaj rewrite.php



  1. <?php
  2. /**
  3.  * Rewrites SEF URLs to their actual files.
  4.  *
  5.  * @copyright (C) 2008-2012 PunBB, partially based on code (C) 2008-2009 FluxBB.org
  6.  * @license <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">http://www.gnu.org/licenses/gpl.html</a> GPL version 2 or higher
  7.  * @package PunBB
  8.  */
  9.  
  10.  
  11. define('FORUM_ROOT', './');
  12. require FORUM_ROOT.'include/essentials.php';
  13.  
  14. // Bring in all the rewrite rules
  15. if (file_exists(FORUM_ROOT.'include/url/'.$forum_config['o_sef'].'/rewrite_rules.php'))
  16. require FORUM_ROOT.'include/url/'.$forum_config['o_sef'].'/rewrite_rules.php';
  17. else
  18. require FORUM_ROOT.'include/url/Default/rewrite_rules.php';
  19.  
  20. // Allow extensions to create their own rewrite rules/modify existing rules
  21. ($hook = get_hook('re_rewrite_rules')) ? eval($hook) : null;
  22.  
  23. // If query string is not set properly, create one and set $_GET
  24. // E.g. lighttpd's 404 handler does not pass query string
  25. if ((!isset($_SERVER['QUERY_STRING']) || empty($_SERVER['QUERY_STRING'])) && strpos($_SERVER['REQUEST_URI'], '?') !== false)
  26. {
  27. $_SERVER['QUERY_STRING'] = parse_url('http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
  28. $_SERVER['QUERY_STRING'] = isset($_SERVER['QUERY_STRING']['query']) ? $_SERVER['QUERY_STRING']['query'] : '';
  29. parse_str($_SERVER['QUERY_STRING'], $_GET);
  30. }
  31.  
  32. // We determine the path to the script, since we need to separate the path from the data to be rewritten
  33. $path_to_script = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']));
  34. if (substr($path_to_script, -1) != '/')
  35. $path_to_script = $path_to_script.'/';
  36.  
  37. // We create our own request URI with the path removed and only the parts to rewrite included
  38. $request_uri = substr(urldecode($_SERVER['REQUEST_URI']), strlen($path_to_script));
  39. if (strpos($request_uri, '?') !== false)
  40. $request_uri = substr($request_uri, 0, strpos($request_uri, '?'));
  41.  
  42. $rewritten_url = '';
  43. $url_parts = array();
  44. // We go through every rewrite rule
  45. foreach ($forum_rewrite_rules as $rule => $rewrite_to)
  46. {
  47. // We have a match!
  48. if (preg_match($rule, $request_uri))
  49. {
  50. $rewritten_url = preg_replace($rule, $rewrite_to, $request_uri);
  51. $url_parts = explode('?', $rewritten_url);
  52.  
  53. // If there is a query string
  54. if (isset($url_parts[1]))
  55. {
  56. $query_string = explode('&', $url_parts[1]);
  57.  
  58. // Set $_GET properly for all of the variables
  59. // We also set $_REQUEST if it's not already set
  60. foreach ($query_string as $cur_param)
  61. {
  62. $param_data = explode('=', $cur_param);
  63.  
  64. // Sometimes, parameters don't set a value (eg: script.php?foo), so we set them to null
  65. $param_data[1] = isset($param_data[1]) ? $param_data[1] : null;
  66.  
  67. // We don't want to be overwriting values in $_REQUEST that were set in POST or COOKIE
  68. if (!isset($_POST[$param_data[0]]) && !isset($_COOKIE[$param_data[0]]))
  69. $_REQUEST[$param_data[0]] = urldecode($param_data[1]);
  70.  
  71. $_GET[$param_data[0]] = urldecode($param_data[1]);
  72. }
  73. }
  74. break;
  75. }
  76. }
  77.  
  78. // If we don't know what to rewrite to, we show a bad request messsage
  79. if (empty($rewritten_url))
  80. {
  81. define('FORUM_HTTP_RESPONSE_CODE_SET', 1);
  82. header('HTTP/1.1 404 Not Found');
  83.  
  84. // Allow an extension to override the "Bad request" message with a custom 404 page
  85. ($hook = get_hook('re_page_not_found')) ? eval($hook) : null;
  86.  
  87. error('Page Not found (Error 404):<br />The requested page <em>'.forum_htmlencode($request_uri).'</em> could not be found.');
  88. }
  89.  
  90. // We change $_SERVER['PHP_SELF'] so that it reflects the file we're actually loading
  91. $_SERVER['PHP_SELF'] = str_replace('rewrite.php', $url_parts[0], $_SERVER['PHP_SELF']);
  92.  
  93. require FORUM_ROOT.$url_parts[0];