I have Wordpress (v3.2.1) set up at domain.org.nz/wordpress with a number of pages set up as domain.org.nz/wordpress/services/example. I want to set up a subdomain, example.domain.org.nz to point to domain.org.nz/wordpress/services/example. When the subdomain is entered into the address bar, it (preferably) should stay as the subdomain (not a redirect). If there are any child pages of /example, the URL needs to appear as example.domain.org.nz/child. I have access to all Wordpress files, .htaccess, DNS settings etc but as I'm on a shared server, I don't have access to the httpd.conf

I know this is a similar question to Multiple Domain Names - One WP Install (non-Multisite) - Default Each Domain name to Category Archive Can I use the same method? If so what needs to be changed for that to work in my instance?

After almost a week of butting my head against this problem, any help is very much appreciated!!

Current .htaccess:

    # BEGIN WordPress  
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /wordpress/
    RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.org\.nz$
    RewriteRule ^(.*) http://domain.org.nz/wordpress/services/%1
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wordpress/index.php [L]

    # END WordPress
  • did you find as solutionfor this?
    – Steven
    Nov 29, 2011 at 17:02

2 Answers 2


Either try placing an index.php file inside your subdomain folder with the following code:

header("HTTP/1.1 301 Moved Permanently");
header("Status: 301 Moved Permanently");
header("Location: http://www.my-domain.com/my-permalink/");

or use cPanel to setup/redirect the subdomain to any address you want.


First you have to configure your server (DNS + Apache) to let the subdomains point to the main site domain. Usually this does not require direct access to httpd.conf but can be configured in the hosting control panel (e.g. if using cPanel you may simply add subdomains (or a wildcard) pointing to the root folder of the site).

Then add a Rewrite Rule to your .htaccess in site's root, before the Wordpress rules (not tested):

RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.org\.nz$
RewriteRule ^(.*) http://domain.org.nz/wordpress/services/%1
  • Hi marcochiesi, thanks for your reply. The code above gets me much further than I have before but results in: Found The document has moved here. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. Nov 23, 2011 at 2:14
  • It looks like I forgot a pair of ( ) in my previous answer. I edited it, please try again. If still not working try to post your .htaccess content. Nov 23, 2011 at 9:35
  • Unfortunately I still get the same 302 error as before :/ I've added the .htaccess (with the code you've given me) in the original question above. Nov 24, 2011 at 4:29
  • Try to change your RewriteRule as follows: RewriteRule ^(.*) http://domain.org.nz/wordpress/services/%1/ [L,P] Nov 24, 2011 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.