• Anonymous User 5870634

    (@anonymized-5870634)


    Hey!

    I’m new to web design/servers, so please pardon me if this post lacks correct jargon.

    I’m trying to set up my blog so that it works with a subdomain. The blog is located at marein.org/words, and works fine there. What I’ve also got working is words.marein.org. That seems to redirect/rewrite/go to the first URL.

    However, what I haven’t got working yet is pages other than the index. For example, I’d like for words.marein.org/newstart to lead to the same as marein.org/words/newstart (a post on the blog). But at the moment, that first link just leads to a 500 Internal Server Error page.

    Someone already gave me this .htaccess code:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^words\.marein\.org$ [NC]
    RewriteRule ^(.*)$ http://marein.org/words/$1 [R=301,L]

    Which at first didn’t work, until I removed the code from .htaccess that WordPress told me to put there. To be clear, I mean this code:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /words/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /words/index.php [L]
    </IfModule>

    Removing that allowed the other code to do its work, but broke WordPress.

    So, my question is, is there a way to combine these two codes so that WordPress works and the subdomain links are rewritten correctly, or perhaps another solution?

    Thanks in advance!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Aside from having the correct .htaccess info you also have to go into Settings > General and specify the URLs there. If you can’t get into your admin, you can use one of the methods here to change the site URL in the database Changing The Site URL.

    Thread Starter Anonymous User 5870634

    (@anonymized-5870634)

    Hey,

    Thanks for your post. So far though, it doesn’t seem to solve the problem.

    I tried changing the URL in Settings > General, but this seemed to break stuff, and I ended up editing wp-config.php to get things back. It looks like this now:

    define('WP_HOME','http://marein.org/words');
    define('WP_SITEURL','http://words.marein.org');

    If I change those, stuff breaks… Meanwhile, words.marein.org/newstart still returns a 500 Internal Server Error.

    Any tips?

    marein –
    unfort you are not alone! if i have the .htaccess file in my directory, i get the 500 error. when i take it out, the site comes up, but i can’t do much (upload pics, change permalinks, etc).

    i wish i had the answer, but not yet. i’m searching though…
    much luck to you!

    after many hours of being frustrated, i simply submitted a ticket to my hosting service and asked them if they had any clue why i was having problems. even though they don’t actively support WP, they graciously helped and i had everything up and working within 30 minutes.

    perhaps try this approach? good luck!

    Thread Starter Anonymous User 5870634

    (@anonymized-5870634)

    Hey loopme,

    Nice to hear you got it sorted, and thanks for the tip! Think I’ll try that.

    Zambrano Sergio

    (@sergiozambrano)

    loopme:
    Can you get post your htaccess content after your hosting service fixed it?

    I’d be very helpful for us.

    Thanks.

    This week I moved a WP blog from a sub-folder to a sub-domain.
    It’s a long story why… *sigh*

    Anyway, in updating the database (replacing all the old URLs with the new one) and then restoring it, I was not able to log in. Even tho in the database the site URL and Home URL were correct.

    What fixed the situation (.htaccess which I could not change as could not log in to admin panel) is what SS_Minow linked to, the codex page on changing the site URL. It was the functions.php solution, very easy, delete it afterwards. Now all is well.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘.htaccess – Subdomain Rewrite Rule’ is closed to new replies.