Addon Domain listed as main account subdirectory

Using a single web hosting account to host multiple sites

Addon Domain listed as main account subdirectory

Postby Diablo » Tue Sep 12, 2006 5:36 am

Hello

I have question about modrewrite, and i've been searching the net and this forum but i still cant find the right answer, so if there's anyone who can help me about this modrewrite. I'll be very glad, and here's my question

for example i have 2 domain under 1 hosting account, and looks like this :

maindomain.com -> is my main account
addondomain.com -> is my addon domain

a detailed structure of my account would looks like this:

/public_html/maindomain/
/public_html/maindomain/addondomain/

everytime i / someone else type addondomain.com at the address bar it'll automatically change into maindomain.com/addondomain

is there a way so when someone else type addondomain.com into the address bar it'll stay same like that without anyone know that its a subdirectory of maindomain ?

Thanks in advance for your answer and sorry for my bad english
Diablo
 
Posts: 4
Joined: Tue Sep 12, 2006 5:26 am

Postby richardk » Tue Sep 12, 2006 8:23 am

What's causing the redirect?

I doubt mod_rewrite can help, you could try this in the /public_html/maindomain directory:
Code: Select all
RewriteEngine On

# addondomain.com --> /addondomain/
RewriteCond %{HTTP_HOST} ^(www\.)?addondomain\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/addondomain(/.*)?$
RewriteRule .* /addondomain%{REQUEST_URI} [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Diablo » Tue Sep 12, 2006 8:41 am

Its not working although i dont get 500 error but by using the rewrite you gave me the resulting url when i type www.addondomain.com into the address bar become :

www.maindomain.com/directory_of_addon_d ... don_domain

and it cause 404 error on my site

and without the modrewrite function you gave me the resulting url when i type www.addondomain.com it'll show like this

www.maindomain.com/directory_of_addon_domain

btw i'll pm you the real url and my .htaccess file so you can understand what im trying to say (its hard for me to explain that in english language) :)
Diablo
 
Posts: 4
Joined: Tue Sep 12, 2006 5:26 am

Postby richardk » Tue Sep 12, 2006 11:19 am

You can try this:
Code: Select all
<IfModule mod_rewrite.c>
  Options +FollowSymLinks

  RewriteEngine On
  RewriteBase /

  # non www to www
  Rewritecond %{HTTP_HOST} ^ADDONDOMAIN\.com [NC]
  RewriteRule ^(.*)$ http://www.ADDONDOMAIN.com/$1 [R=301,L]

  RewriteCond %{HTTP_HOST} !^www\.(MAINDOMAIN|ADDONDOMAIN)\.com  [NC]
  RewriteRule ^(.*)$ http://www.MAINDOMAIN.com/$1 [R=301,L]

  # Tolak semua yg pake Java ato Python kecuali Yahoo ma Google
  RewriteCond %{HTTP_USER_AGENT} ^(Python[-.]?urllib|Java/?[1-9]\.[0-9]) [NC]
  RewriteCond %{REMOTE_ADDR} !^66\.102\.([0-9]|1[0-5])\.
  RewriteCond %{REMOTE_ADDR} !^216\.239\.(3[2-9]|[45][0-9]|6[0-3])\.
  RewriteCond %{REMOTE_ADDR} !^207\.126\.2(2[4-9]|3[0-9])\.
  RewriteRule .* - [F]

  # Feedburner redirecting buat orang kecuali bot
  RewriteCond %{HTTP_USER_AGENT} !RSS|Aggre|Crawl|Seek|Google|Yahoo|Feed|Spider|Bot|Wordpress|Ask|Blog|Fetch|Ping|Comment [NC]
  RewriteRule ^feed/?([-_0-9a-z]+)?/?$ http://feeds.feedburner.com/ReaperX [R=301,NC,L]

  # Buat wordpress
  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteRule . /index.php [L]
</IfModule>
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Diablo » Tue Sep 12, 2006 11:55 am

Thanks a thousand RichardDK ... no .. it should be a million !!! you're trully a modrewrite guru beside fixing my problem with my addon domain, you give another shortcut to the feedburner feed (i think i need to learn more about modrewrite here). And once again thanks alot Richard. You're the best :)
Diablo
 
Posts: 4
Joined: Tue Sep 12, 2006 5:26 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 24 guests

cron