This is a discussion on Strange redirect when missing trailing slash within the Apache Web Server forums, part of the Web Server and Related Forums category; I have approx. 60 domains hosted under one cPanel account on a leased dedicated server (CentOS 4.4 i686, Apache ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have approx. 60 domains hosted under one cPanel account on a leased
dedicated server (CentOS 4.4 i686, Apache 1.3.37). So there is a parent domain, and the rest are subdomains of the parent domain. directory structure in of public_html is like this: /public_html/html of parent domain /public_html/domain1/html of domain1 /public_html/domain2/html of domain2 .... and so on. So "domain1.com" is technically "domain1.parentdomain.com" If I go to "domain1.com/folder/" (with a trailing slash), everything is fine. If I go to "domain1.com/folder" (without a trailing slash), I am redirected to domain1.parentdomain.com/folder/ (with a trailing slash). So apache checks to see if "/folder" is a file or a directory, sees that it is a directory, then does a 301 to "/folder/" (with a trailing slash), and the domain part gets rewritten into the subdomain format. In my searching for a resolution, I've noticed other people referring to these settings in httpd.conf: UseCanonicalName = on ServerName = www.parentdomain.com If you'd like to see this all in action, check out www.cuppys.com/encyclopedia/. If you remove the trailing slash, you will be redirected to cuppys.medinaenterprises.com/encyclopedia/ Is there maybe a rewrite rule I could use to subvert this? |
|
|||
|
"PseudoMega" <pseudomega@gmail.com> schreef in bericht
news:1165022702.768132.214420@n67g2000cwd.googlegr oups.com... >I have approx. 60 domains hosted under one cPanel account on a leased > dedicated server (CentOS 4.4 i686, Apache 1.3.37). So there is a > parent domain, and the rest are subdomains of the parent domain. > > directory structure in of public_html is like this: > > /public_html/html of parent domain > /public_html/domain1/html of domain1 > /public_html/domain2/html of domain2 > > ... and so on. > > So "domain1.com" is technically "domain1.parentdomain.com" > > If I go to "domain1.com/folder/" (with a trailing slash), everything is > fine. > If I go to "domain1.com/folder" (without a trailing slash), I am > redirected to domain1.parentdomain.com/folder/ (with a trailing slash). > > So apache checks to see if "/folder" is a file or a directory, sees > that it is a directory, then does a 301 to "/folder/" (with a trailing > slash), ... That's mod_dir doing its job http://httpd.apache.org/docs/2.0/mod...directoryslash > ... and the domain part gets rewritten into the subdomain format. Wonder whether 'UseCanonicalName = off' may solve that http://httpd.apache.org/docs/2.0/mod...ecanonicalname > If you'd like to see this all in action, check out > www.cuppys.com/encyclopedia/. If you remove the trailing slash, you > will be redirected to cuppys.medinaenterprises.com/encyclopedia/ I guess there is some rewrite interfering with the request too. Might look like RewriteCond %{HTTP_HOST} ([^\.]+).com$ RewriteRule (.*) /%1$1 [PT,QSA] > Is there maybe a rewrite rule I could use to subvert this? Show us the current rules and conditions first. HansH |
|
|||
|
> > ... and the domain part gets rewritten into the subdomain format.
> > Wonder whether 'UseCanonicalName = off' may solve that > http://httpd.apache.org/docs/2.0/mod...ecanonicalname Well, I turned it off and it seems that my problem is resolved... I'll need to contact the sysad who compiled this machine to make sure there wasn't a good reason for having it turned on. Thanks for the suggestion Hans! |