Add-on domain - Trailing Slash problem

Using a single web hosting account to host multiple sites

Add-on domain - Trailing Slash problem

Postby divinal » Mon Nov 20, 2006 9:11 am

Hi guys.

I need some help here. I have a hosting account, running Apache version 1.3.37 (Unix) with two addon domains.

The problem i get is when accessing a addon domain directory, without a trailing slash, it redirects to the same directory is the main domain... If i write:

www.Addon-Domain.com/folder/ it's ok.

but

www.Addon-Domain.com/folder (without the slash)--> goes to: http://Addon-Domain-Folder.Main-Domain.com/folder/

I want it to stick to the addon domain, don't letting the users know my main domain.

I've searched the forum looking for the same error, but i haven't found any solution... :(

Thanks for the help!
divinal
 
Posts: 2
Joined: Mon Nov 20, 2006 8:59 am
Location: Portugal

Postby richardk » Mon Nov 20, 2006 11:29 am

Are you using mod_rewrite code? If you are, post it. What's the addon-domain's document root?

The following would probably work in the addon-domain's document root:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.ADDON-DOMAIN\.com$ [NC]
RewriteRule ^(.*)$ http://www.ADDON-DOMAIN.com/$1 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby divinal » Tue Nov 21, 2006 2:46 am

Hi richardk. thanks for the answer.

The code you gave doesn't work :(

This is the main domain .htaccess:
Code: Select all
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>

<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>


The addon domain is a folder in the main domain, like /public_html/addon-folder/

The .htaccess for the addon domain (it's a wordpress instalation):
Code: Select all
# BEGIN WordPress
<IfModule mod_rewrite.c>

Options +FollowSymLinks

RewriteEngine On

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


In another folder in the addom-domain i have an installation of a PunBB forum, with a .htaccess:
Code: Select all
RewriteEngine on
RewriteRule ^f([0-9]+)(.*).html$ viewforum.php?id=$1 [L]
RewriteRule ^t([0-9]+)(.*).html$ viewtopic.php?id=$1 [L]
RewriteRule ^p([0-9]+)(.*).html$ viewtopic.php?pid=$1 [L]
RewriteRule ^(.*).rss$ extern.php?action=$1&type=rss [L]
RewriteRule ^blabla.html$ index.php [L]


I've tried several things, but none worked... Maybe the problem isn't in th .htaccess... Any suggestions?

Thanks in advance.
divinal
 
Posts: 2
Joined: Mon Nov 20, 2006 8:59 am
Location: Portugal

Postby richardk » Tue Nov 21, 2006 9:00 am

Put the following in a .htaccess file in the /public_html/addon-folder directory:
Code: Select all
<IfModule mod_rewrite.c>
  Options +FollowSymLinks

  RewriteEngine On

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

  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteRule . /index.php [L]
</IfModule>
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 108 guests

cron