Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Addon domains! Is there any sense on it on Apache?


galench - 1:57 pm on Mar 26, 2008 (gmt 0)


1.

Your links are defined by the code on the page, or the code that produces the page. Mod_rewrite cannot change your code, so you must change your code.

Don`t know, but i have this code in main domain, and it`s works fine:

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^/?$ http://www.example.com/mainsite/index.php [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^index.htm$ http://www.example.com/mainsite/index.php [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^index.html$ http://www.example.com/mainsite/index.php [R=301,L]

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

Maybe because it`s redirecting first from main folder to http://www.example.com/mainsite/index.php
But it`s works fine!

But in addon domain it`s not working!

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

2. Sorry jdMorgan! Maybe i stupid, but this code doesn`t work in htaccess file in main folder:

# If direct client request for www.example.com/addon or example.com/addon, redirect back to example.com domain
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /addon/?
RewriteRule ^addon/?(.*)$ http://example.com/$1 [R=301,L]

This why i aded these lines:

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^400.shtml$ http://www.example.com [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^401.shtml$ http://www.example.com [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^403.shtml$ http://www.example.com [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^404.shtml$ http://www.example.com [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^500.shtml$ http://www.example.com [R=301,L]


Thread source:: http://www.webmasterworld.com/apache/3607140.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com