Domain alias & .htaccess urlrewrite

Using a single web hosting account to host multiple sites

Domain alias & .htaccess urlrewrite

Postby Prashant2k » Thu Jan 24, 2008 7:37 am

Hello,
I have three domain names and one webhosting.
Maindomain.com
Domainalias.com & domainalias2.com(not working with this now but require for future updates.)
I have added www.domainalias.com and domainalias.com in domain alias of maindomain.com
I have set proper DNS in domainalias.com also.
I am using following code in .htaccess of maindomain.com.

#code Begin
#http://forum.modrewrite.com/viewtopic.php?=&p=10265
Options +FollowSymLinks
RewriteEngine On

# to stop mod_dir redirecting to the maindomain.com URL
# when you miss a trailing slash, add the missing slashes
RewriteCond %{DOCUMENT_ROOT}/domainalias%{REQUEST_URI}/ -d [OR]
RewriteCond %{DOCUMENT_ROOT}/domainalias2%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

# as long as it's not a sub request (to stop loops)
RewriteCond %{ENV:REDIRECT_STATUS} ^$
# match the domain name
RewriteCond %{HTTP_HOST} ^(www\.)?(domainalias|domainalias2)\.com$ [NC]
# add it as the first directory and rewrite
RewriteRule ^(.*)$ /%2/$1 [QSA,L]
#code ends


I am getting following problem
1) When I open www.domainalias.com and click on homepage link in it. It shows url like http://www.domainalias.com/domainalias/index.php
How should I remove http://www.domainalias.com/domainalias/ & use only http://www.domainalias.com/

Can anyone help me to overcome situation.

Thanks

Prashant Jangam
Prashant2k
 
Posts: 2
Joined: Wed Jan 23, 2008 1:41 pm

Postby richardk » Thu Jan 24, 2008 11:58 am

I am getting following problem
1) When I open www.domainalias.com and click on homepage link in it. It shows url like http://www.domainalias.com/domainalias/index.php

That mod_rewrite should not do that. Does it still happen if you remove the mod_rewrite? Do you have any other mod_rewrite?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Prashant2k » Thu Jan 24, 2008 2:49 pm

I have only this code in .htaccess of root folder. i have another .htaccess file which is in domainalias folder and is different.

#code from .htaccess file of domainalias

##Pages redirect
RewriteRule %{REQUEST_URI} !page-[0-9]+\.html?$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)\.html$ page.php?name=$1 [NC,QSA,L]

##Category redirect
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php [QSA,L]
Prashant2k
 
Posts: 2
Joined: Wed Jan 23, 2008 1:41 pm

Postby richardk » Fri Jan 25, 2008 3:56 pm

That shouldn't cause a redirect either. Does it still happen if you remove the mod_rewrite?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 8 guests

cron