Support » Fixing WordPress » Redirect domain to subdomain wordpress private site

  • Resolved DerrickG72

    (@derrickg72)


    Hello, I am having some trouble redirecting my wordpress subdomain.

    I want http://www.example.net to be redirected to http://members.example.net. I thought I could do this through cpanel but it throws out this error message:

    There was an error adding the redirect.

    Apache detected an error in the Rewrite config.

    Syntax error on line 4 of /home/xxxx/public_html/.htaccess.kpP4JcC8W1HZx0VWoHj658z3pGBavnV1: Invalid command 'suphp_configpath', perhaps misspelled or defined by a module not included in the server configuration 

    Please try again.

    So I am assuming that the module “Private Site” that I am using is stopping this from happening??

    This is the info that is in my .htaccess file:

    # 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]
    </IfModule>

    # END WordPress

    So the rewrite option is on but it wont let me redirect.

    Any thoughts on this???

    Thanks,

    Derrick

Viewing 13 replies - 1 through 13 (of 13 total)
  • Ben

    (@benbornschein)

    Here 🙂

    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} ^www.example.net$ [NC]
    RewriteRule ^(.*) http://members.example.net/$1 [QSA,R=301,L]
    
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    Thread Starter DerrickG72

    (@derrickg72)

    Ben, I dont think I explained myself right. I added your info to the htaccess that lives inside my subdomian, but I think I need to have it in my root of my main domain not sub.

    So basically when someone goes to schylling.net they are to be redirected to members.schylling.net.

    So If I added your code to my root folder htaccess file would that work?

    Thanks,

    Derrick

    Ben

    (@benbornschein)

    Correct, you have to add it to your root where your schylling.net is linked to.

    Thread Starter DerrickG72

    (@derrickg72)

    Something has gone arry!! This is the error I get:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster@members.schylling.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

    Ben

    (@benbornschein)

    Please post your complete .htaccess, maybe it is just a little syntax error.

    Thread Starter DerrickG72

    (@derrickg72)

    Ok, I figured out that I had the same 2 acess files in root and sub. So I removed the one from the sub. So now if you type in http://www.schylling.net you end up at http://members.schylling.net But when you type in http://schylling.net you end up at the root and not at members. What is the code to add just http://?

    Ben

    (@benbornschein)

    To fix this, instead of
    RewriteCond %{HTTP_HOST} ^www.schylling.net$ [NC]
    write
    RewriteCond %{HTTP_HOST} ^(www.)?schylling.net$ [NC]

    • This reply was modified 6 years, 9 months ago by Ben.
    Thread Starter DerrickG72

    (@derrickg72)

    Well Ben, I killed it. This is what I get now when I try it with www. or without:
    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, webmaster@schylling.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

    And here is what I have in htaccess file:

    # To set your custom php.ini, add the following line to this file:
    suphp_configpath /home/schyll5/public_html/php.ini

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{HTTP_HOST} ^(www.)?schylling.net$ [NC]
    RewriteRule ^(.*) http://members.schylling.net/$1 [QSA,R=301,L]

    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    Thread Starter DerrickG72

    (@derrickg72)

    Ben, I copied the code from that link and I still have the 500 internal server error. Did I screw this up big time or what!!!!

    Ben

    (@benbornschein)

    I checked my code again, it works. You can also try to download my schylling.txt rename it to .htaccess and upload it to your website.

    • This reply was modified 6 years, 9 months ago by Ben. Reason: Removed my ask to get ftp access

    @benbornschein: Thanks for helping out, but please don’t do that: when you offer to get admin access and/or FTP access then you’re really going too far and that’s not cool.

    https://make.wordpress.org/support/handbook/forum-welcome/#the-bad-stuff

    If you are given admin credentials, you are potentially liable for any potential damage that maybe caused, not only by yourself but anyone accessing the system. Even if you do not provide warranty with your own product.

    Unless you’re willing to take responsibility for that user’s installation from now on (and they should NOT let you do that) then please do not ask or suggest that someone provide you those admin or FTP details.

    You can provide assistance here, ask for log data, you can make recommendations and even suggest changes. But do not seek admin or FTP access. That’s just going too far.

    Thread Starter DerrickG72

    (@derrickg72)

    Ok, I downloaded your TXT file, and then added this fix:

    RewriteCond %{HTTP_HOST} ^(www.)?schylling.net$ [NC]

    And now all is well!

    Thanks for all your help Ben!

    Ben

    (@benbornschein)

    I’m glad I could help you 🙂

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Redirect domain to subdomain wordpress private site’ is closed to new replies.