Domain Forward http should not lower case

Discussion in 'General' started by pcxtra, Jan 23, 2009.

  1. pcxtra

    pcxtra New Member

    Issue + solution: I have a domain which needs to forward to another url with case sensitive URL. I used the domain forward form in the co-domain tab.

    The forward URL should be something like http://www.mydestdomain.com/pageXYZ.html
    while ISPconfig forces to lowercase and will forward to
    http://www.mydestdomain.com/pagexyz.html

    The piece of code responsible to force lowercase is in the file /root/ispconfig/scripts/lib/config.lib.php:

    PHP:
      if(substr($domain["domain_weiterleitung"],0,4) == "http" || substr($domain["domain_weiterleitung"],0,4) == "HTTP"){
                
    $domain["domain_weiterleitung"] = [COLOR="Red"]strtolower[/COLOR]($domain["domain_weiterleitung"]);
                if(
    substr($domain["domain_weiterleitung"],-1) == "/"$domain["domain_weiterleitung"] = substr($domain["domain_weiterleitung"],0,-1);
                
    $rewrite_rule .= "\nRewriteRule ^/(.*)         ".$domain["domain_weiterleitung"]."/$1 [L,R]";
              } else {
                
    //if(substr($domain["domain_weiterleitung"],-1) != "/") $domain["domain_weiterleitung"] .= "/";
                
    if(substr($domain["domain_weiterleitung"],0,1) != "/"$domain["domain_weiterleitung"] = "/".$domain["domain_weiterleitung"];
                
    $rewrite_rule .= "\nRewriteRule   ^/(.*)$  http://".$servername.$domain["domain_weiterleitung"]."$1  [R]";
              }
    So locate the strtolower( ) call and remove it. This will prevent the forward URL to be converted to lowercase.

    the correct result (after fix) in /etc/httpd/conf/vhosts/Vhosts_ispconfig.conf:

    ewriteEngine on
    RewriteCond %{HTTP_HOST} ^mysourcedomainn\.com [NC]
    RewriteRule ^/(.*) http://www.mydestdomain.com/pageXYZ.html?/$1 [L,R]
    RewriteCond %{HTTP_HOST} ^www\.mysourcedomain\.com [NC]
    RewriteRule ^/(.*) http://www.mydestdomain.com/pageXYZ.html?/$1 [L,R]



    Furthermore you cannot forward the main domain, but only the co-domain. I had to change the www of the main domain into 'forward' (or something else never used), then make two co-domains, one with www and one without and both to forward to the new URL.

    Somthing ISPConfig could implement?
     
  2. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    I've added this to the bugtracker.
     

Share This Page