Welcome to WebmasterWorld Guest from 174.129.96.175

Forum Moderators: Ocean10000 & incrediBILL & phranque

.htaccess issue with add-on domains

and wordpress

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

10+ Year Member



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?

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

10+ Year Member



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!

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

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

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

10+ Year Member



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

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

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month