Forum Moderators: phranque
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?
<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!
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
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