Support » Fixing WordPress » Pretty permalinks to subdomains rewrite HELP!

  • I’ve spent the last two days trying to find a solution and now I’m bordering on going bonkers!

    I have WordPress installed on and some pages set up with pretty permalinks as, etc.

    What I want is for people to be able to go to and for it to mirror what’s at i.e.
    They can go to or and they will be the same (the url will stay the same as what they typed in).

    I’ve tried a number of different rewrite rules in the htaccess but so far it either redirects to the root, goes to or I get a 501 internal server error that porked up all the current subdomains.

    I have tried solving this myself but as I have cognitive problems, I’m struggling to work out the needed code myself. If someone could give me the code to copy paste into the htaccess that would be very much appreciated!! Also bearing in mind that at some point will be changed to just but the wordpress install will stay in the /wordpress/ subdirectory.

    Thanks in advance, tis much appreciated! 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • Sorry, I forgot to mention that I’m on a shared server so I cannot create wildcard subdomains but as I won’t be requiring a kajillion subdomains, I don’t mind entering each subdomain manually into the htaccess 🙂

    Surely someone has even a little snippet of info? 🙁

    Ok, well so far I have my host set up so that the subdomain points to the WordPress web directory i.e. home/user/
    The htaccess within that directory looks like this:

    RewriteEngine On
    RewriteBase /wordpress/
    RewriteCond %{HTTP_HOST} ^(www\.)?[^.]+\.test\.mydomain\.org\.nz.*$
    RewriteRule (.*)$1 [L]
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /wordpress/index.php [L]

    However that does not work. I got that code from a basic ‘how to’ of a rewrite a subdomain to a directory. So far I’m still at a loss as to how to get this damn thing to work and swearing at it isn’t working either…

    WordPress recommends this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress

    in the root of your WordPress directory (same location as wp-config.php)

    Also, ask your host about the first if statement above. The mode rewrite modules must be installed and running.

    Add this to your themes header.php file to test if permalinks are on:

    <?php if ( get_option('permalink_structure') != '' ) { echo 'permalinks enabled'; } ?>

    If on, the text “permalinks enabled” will appear in the header of that page in your browser that has been refreshed for that page/site.

    Yes, that’s what is in the htaccess by default. But the problem isn’t with getting permaliks to work – pretty permalinks work just fine. The issue is with getting a subdomain to point to a wordpress permalink URL e.g. typing in will take you to

    Typically, with most good web hosts anyway, a sub-domain is mapped using an record in the DNS setup to point to the folder associated with the sub-domain…this is web host specific, and a topic to discuss with the folks who work with domains at your web host. GoDaddy has a help page on this, of course, and again, this is web host specific.

    I have the DNS settings correctly pointing to the right directory. I can’t however point the subdomain to the permalink as it’s not an actual directory.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Pretty permalinks to subdomains rewrite HELP!’ is closed to new replies.