How set htaccsess for 2 domain

Using a single web hosting account to host multiple sites

How set htaccsess for 2 domain

Postby hmarei » Fri Jun 29, 2007 1:55 am

I Have a Weblog Service! I had a Domain & With this domain my customer Opening their Blog. For Example : http://blogname.firstmydomain.com
Now I Will my customer Opening their Blog By New Domain & Firstdomain.
For Example :http://blogname.firstmydomain.com & http://blogname.NEWdomain.com
Now How set htaccsess or other setting For This.
e : New Domian Parking In My host
Thanks!
--------------------------------------------
My htaccess for firstDomain:
Code: Select all
RewriteEngine On
Options +Followsymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\. [NC]
RewriteCond %{REQUEST_FILENAME}!^.*/images/.*$
RewriteCond %{REQUEST_FILENAME}!^.*/uploads/.*$
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.example\.com(:80)?<>/([^/]*) [NC]
RewriteCond %1<>%3!^(.*)<>\1$ [NC]
RewriteRule ^(.*)$ - [E=BLOGUSER:%1]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^$ /index.php?w=%1 [L]
RewriteRule ^page([0-9]+)/([^/]+)?$ /index.php?w=%1&page=$1$2 [L]
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule ^profiles/([^/]+)/([^/]+)?$ /profile.php?u=$1$2 [L]
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule ^profiles/?$ /profile.php [L]
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule ^albums/([^/]+)/([^/]+)?$ /album.php?u=$1$2 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^archive/(.*)/(.*)/([^/]+)?$ /archive.php?w=%1&y=$1&m=$2$3 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^archive/(.*)/([^/]+)?$ /archive.php?w=%1$1 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^archive/([^/]+)?$ /archive.php?w=%1$1 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^friends/([^/]+)?$ /friends.php?w=%1$1 [L]
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule ^([^/]+)/friends/page([0-9]+)/([^/]+)?$ /friends.php?w=$1&page=$2$3 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^([0-9]+)/([^/]+)?$ /entry.php?w=%1&e_id=$1$2 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ([^/]+)^$ /index.php?w=%1$1 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^([^/]+)/([^/]+)?$ /index.php?w=%1&category=$1$2 [L]
RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^([^/]+)/page([0-9]+)/([^/]+)?$ /index.php?w=%1&category=$1&page=$2$3 [L]
hmarei
 
Posts: 5
Joined: Fri Jun 29, 2007 1:51 am

Postby richardk » Fri Jun 29, 2007 11:01 am

Try replacing
Code: Select all
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.example\.com(:80)?<>/([^/]*) [NC]
RewriteCond %1<>%3!^(.*)<>\1$ [NC]

with
Code: Select all
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.(firstdomain|newdomain)\.com(:80)?<>/([^/]*) [NC]
RewriteCond %1<>%4 !^(.*)<>\1$ [NC]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

thanks & one question ?

Postby hmarei » Sat Jun 30, 2007 1:58 am

hi richardk
thanks very Good.
now how set htaccess
http://everyblog.newdomain.com >>> http://everyblog.firstdomain.com
thanks :P
hmarei
 
Posts: 5
Joined: Fri Jun 29, 2007 1:51 am

Postby richardk » Sat Jun 30, 2007 3:18 pm

now how set htaccess
everyblog.newdomain.com >>> everyblog.firstdomain.com

I don't understand. Do you want to redirect from the new domain to the first domain?

If you do, there was no point in the previous edit. Just add
Code: Select all
RewriteCond %{HTTP_HOST} ^(.*\.)?newdomain\.com$ [NC]
RewriteRule ^(.*)$ http://%1firstdomain.com/$1 [R=301,L]

after
Code: Select all
RewriteBase /

in the original mod_rewrite.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

very good

Postby hmarei » Fri Jul 06, 2007 3:14 am

thanks . Now how set htacces for my blogs open by www and without www
for example : http://www.sss.mydomian.com & http://sss.mydomian.com
hmarei
 
Posts: 5
Joined: Fri Jun 29, 2007 1:51 am

Postby richardk » Fri Jul 06, 2007 6:11 am

Replace
Code: Select all
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.example\.com(:80)?<>/([^/]*) [NC]
RewriteCond %1<>%3!^(.*)<>\1$ [NC]
RewriteRule ^(.*)$ - [E=BLOGUSER:%1]

with
Code: Select all
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^(www\.)?([^\.]+)\.example\.com(:80)?<>/([^/]*) [NC]
RewriteCond %2<>%4 !^(.*)<>\1$ [NC]
RewriteRule ^(.*)$ - [E=BLOGUSER:%2]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Re: thanks & one question ?

Postby hmarei » Fri Nov 06, 2009 12:53 am

hmarei wrote:hi richardk
thanks very Good.
now how set htaccess
http://everyblog.newdomain.com >>> http://everyblog.firstdomain.com
thanks :P


i want to http://www.everyblog.newdomain.com >>> http://www.everyblog.firstdomain.com


with www !
hmarei
 
Posts: 5
Joined: Fri Jun 29, 2007 1:51 am


Return to Domain Handling

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests

cron