WordPress.org

Ready to get started?Download WordPress

Forums

RewriteRule for 'virtual host' pointing to subdirectory (3 posts)

  1. bowa
    Member
    Posted 5 years ago #

    i have a clients site is running on http://www.firstdomain.com with a wordpress 2.7 installation

    it has both posts and pages.

    now they want a second domain (www.seconddomain.com) showing the content of 'pages' that are children of a certain page.

    so a http://www.seconddomain.com would show the content of
    http://www.firstdomain.com/my-special-category

    and http://www.seconddomain.com/lorem-ipsum would show the content of
    http://www.firstdomain.com/my-special-category/lorep-ipsum

    is this possible to do with adding rewriterules to the .htaccessfile ??
    so i dont have to setup a second wordpress for them that only has 'pages'.

    thanks in advance

  2. bowa
    Member
    Posted 5 years ago #

    i worked this out ....

    i put this in my .htaccess

    RewriteCond %{HTTP_HOST}        ^www.seconddomain.com
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*) /index.php/my-special-category/$1 [L]
    
    #The default wordpress things
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    http://www.seconddomain.com/lorem-ipsum is showing
    http://www.firstdomain.com/my-special-category/lorep-ipsum
    correctly

    but
    http://www.seconddomain.com/
    redirects to my http://www.firstdomain.com and i think it is something in the wordpress rewrite class that does something special for ^/$

    anyone has a clue ?

  3. MarkRH
    Member
    Posted 5 years ago #

    Might try changing

    RewriteCond %{HTTP_HOST}        ^www.seconddomain.com

    to

    RewriteCond %{HTTP_HOST} ^www.seconddomain.com$

Topic Closed

This topic has been closed to new replies.

About this Topic