homepage Welcome to WebmasterWorld Guest from 54.226.93.128
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
.htaccess issue with add-on domains
and wordpress
Roel




msg:1514112
 2:18 am on Feb 8, 2006 (gmt 0)

Hi guys

I am using wordpress 2.0 on a certain domain, hosted on apache (with cpanel). I use /category/article.html for the permalinks so my .htaccess (uptill now) looked like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /index.php
</IfModule>

and worked great.

However, today I am adding add-on domains into cpanel. Let's say addondomain.com

Doing this makes a directory under /public_html/ : /public_html/addondomain/

Now when I access [addondomain.com...] it re-directs it do [originaldomain.com...] due to the re-write rule above

I have been trying all sort of things including the following:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^originaldomain.com
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.*)$ /index.php [L]

RewriteCond %{HTTP_HOST} ^addondomain.com
RewriteCond %{REQUEST_URI}!/addondomain/
RewriteRule ^(.*)$ /addondomain/$1 [L]
</IfModule>

Allthough the originaldomain.com still works just fine with this last re-write ruleset,

the new domain [addondomain.com...] still redirects to [originaldomain.com...]

Can any professional help me with this?

 

Roel




msg:1514113
 2:59 am on Feb 8, 2006 (gmt 0)

So in fact what I would like to do is install wordpress 2 into the add-on domain as well. My .htaccess would need to look something like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /addondomain/
RewriteCond %{HTTP_HOST} ^addondomain.com
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /addondomain/index.php
RewriteBase /
RewriteCond %{HTTP_HOST} ^originaldomain.com
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /index.php
</IfModule>

But unfortunately the above does not work either - please help!

jdMorgan




msg:1514114
 3:11 am on Feb 8, 2006 (gmt 0)

It seems to me that your additional code in the first post should have fixed your problem. Did you flush your browser cache after uploading the new code and before testing it?

Jim

Roel




msg:1514115
 3:38 am on Feb 8, 2006 (gmt 0)

Hi Jim

Thanks for replying.

Yes, I used CTRL-SHIFT-REFRESH to load the pages to ensure I got a fresh copy from the server

It does not seem to work for the add-on domain (all pages still redirect to the main domain). For the main domain it works fine.

Maybe it's an issue with wordpress, although I would asume if the re-write happened correctly the add-on domain would not be aware of the main domain.

Cheers
Roel

jdMorgan




msg:1514116
 4:45 am on Feb 8, 2006 (gmt 0)

You should probably check the location of the .htaccess file with the rewrites against the path to the add-on as defined by your control panel. Also check the filepath for %{REQUEST_FILENAME} -- you may need to prepend /addondomain/ to it.

Easiest way to see that value would be to do a test redirect, and read it from the address bar:

RewriteRule ^addondomain/(.*)$ http://www.example.com/$1?%{REQUEST_FILENAME} [R,L]

Everything depends on the rewrite code .htaccess file location and the actual filepaths that you are checking. They have to agree.

Oh, one more: In some cases, the construct
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}
is needed. Or in this case, perhaps
RewriteCond %{DOCUMENT_ROOT}addondomain/%{REQUEST_FILENAME}

It's rather inconvenient to test all of these possibilities, but you should be able to get it working.

Also, I'd avoid RewriteBase if possible, and just code the base into your rule. Not sure about using two RewriteBases in the same file...

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved