Viewing 5 replies - 1 through 5 (of 5 total)
  • Untested, but you can do something like this…

    <IfModule mod_rewrite.c>
    	RewriteEngine On
    	RewriteCond %{HTTP_HOST} subdomain1\.domainname\.com
    	RewriteCond %{HTTP_HOST} subdomain2\.domainname\.com
    	RewriteRule ^(.*)$ http://www.domainname.com/blog/$1 [R=301,L]
    	RewriteCond %{HTTP_HOST} !^www\.domainname\.com
    	RewriteRule ^(.*)$ http://www.domainname.com/$1 [R=301,L]
    </IfModule>
    Thread Starter nsne

    (@nsne)

    I’ve tried entering this into my .htaccess file a hundred different ways, but nothing seems to work. It leads me to believe that I’m just not doing something right.

    Here’s the code that currently exists in my .htaccess file:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    --- BEGIN CODE ---
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    
    --- END CODE ---

    So where exactly do I cut/copy to apply the new “rewrite” code correctly?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Above the block you pasted 🙂

    What you posted was WP’s standard code. That always belongs at the bottom of your .htaccess file.

    Thread Starter nsne

    (@nsne)

    Not working, unfortunately. I get a “500 Internal Server Error” whenever I try to access the website(s) in any way.

    Not sure if there are any other settings I have to amend to account for the modified subdomain jiggery pokery in the .htaccess file.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Not in .htaccess, no.

    What I want is for diderot.iannelli.us AND diderotsdiary.iannelli.us to redirect to http://www.iannelli.us/diderot/

    So this:

    RewriteCond %{HTTP_HOST} ^(diderot|diderotsdiary)\.iannelli\.us
    RewriteRule ^(.*) http://iannelli.us/diderot/$1 [L,R=301]

    I use something very much like that for my own sites, works great.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Subdomain point to subfolder (xyz.123.com -> 123.com/xyz/)’ is closed to new replies.