PDA

View Full Version : Domain redirecting problem


smac1979
5-11-04, 02:37 PM
I originally had this post in the Domain names & DNS portion of the forum but I think it'd do better here. I have 2 domains, one is of course pointing to my htdocs folder, the second; a sub folder. when I enter the url www.domain1.com I get the index.html in my htdocs folder. When I enter the the url www.domain2.com I get the index.html in my sub folder. So everything works well. Until I enter the url www.domain2.com/index.html, it then redirects to my domain1 index.html in the htdocs folder. I think this has to do with the way my .htaccess is setup, as of now, I have it so that when I go to my first domain www.domain1.com it automatically redirects to a directory. Could the problem be in the vague redirection line that says 'Redirect /index.html'? Thanks for any help.


RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} domain2.com
RewriteCond %{REQUEST_URI} !subfolder/
RewriteRule ^(.*)$ subfolder/$1 [L]
Redirect /index.html http://domain1.com/data/

tbonekkt
5-11-04, 02:40 PM
Directories inherit the .htaccess rules/definitions/coding of the directory above it. If you simply upload a blank .htaccess file into your second domain's directory, I think it should solve your problem.

extras
5-11-04, 03:26 PM
If you don't understand how it works
or you don't want to bother learning,
it's easier to do as Tom suggested.


If you insist on doing with .htaccess,
I don't understand what you want to do with this.
This does not make sense to me.
Redirect /index.html http://domain1.com/data/

You are redirecting any URL that contains "/index.html".
So, "http://domain2.com/index.html" will get redirected.

I woud say, just remove it, or at least modify like this.
Redirect ^/index.html http://domain1.com/data/

stevel
5-11-04, 04:26 PM
That is not correct. The Redirect line does not use regular expressions - it matches from the beginning of the URL (not including the domain). So /index.html matches exactly that, not /subdir/index.html

See http://httpd.apache.org/docs/mod/mod_alias.html#redirect

I would rather use DirectoryIndex to specify the default file.

extras
5-11-04, 04:41 PM
oops, I was thinking as if Rewriterule.
Thank you for correcting, stevel.