• jorwesflow

    (@jorwesflow)


    i know there are a lot of similar questions on this forum, but i still don’t “get it”. i have a wordpress install located in subdirectory: https://www.bethany-ag.org/nightlife but i want users to be able to use the URL: nightlife.bethany-ag.org to get to there.

    how do i use the .htaccess 301 redirect to do so? and how does this coincide with the General Settings page where I can edit the WordPress Address (URL) and the site address (URL)?

    and can anyone explain what the individual lines of code mean? the .htaccess file i have already looks like 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]
    </IfModule>
    
    # END WordPress

    thanks loads!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Samuel B

    (@samboll)

    use your host’s cpanel or whatever and create a sub domain that uses that directory

    after doing so, change the 2 url’s in
    dashboard – settings – general
    to the sub domain url

    Thread Starter jorwesflow

    (@jorwesflow)

    use your host’s cpanel or whatever and create a sub domain that uses that directory

    after doing so, change the 2 url’s in
    dashboard – settings – general
    to the sub domain url

    well i had already taken care of contacting my host and creating the subdomain that uses that directory. so that was already set up. i went to dashboard – settings – general and changed the 2 URL’s. now, there’s some weird stuff happening: if i browse to nightlife.bethany-ag.org, it just takes me to the same place as https://www.bethany-ag.org. try it yourself…
    if i go to nightlife.bethany-ag.org/wp-admin, it tells me my password is wrong and then redirects me to the https://www.bethany-ag.org/wp-admin login screen.

    i can’t even get back to the nightlife wp-admin to change the 2 URL’s back.

    Samuel B

    (@samboll)

    you can easily change the url’s back
    https://codex.www.ads-software.com/Changing_The_Site_URL

    the subdomain is not set up correctly or it would work

    edit –
    are you sure you set BOTH url’s to the subdomain? because it looks as if one points to root

    I actually have noticed this same problem with subdomains

    any time you try to login to the subdomain with the admin credentials the page has been redirected to the wp-login.php page with this addresss

    https://sub.domain.com/wp-login.php?redirect_to=http%3A%2F%2Fsub.domain.com%2Fwp-admin%2F&reauth=1 . This is while being logged into the wp-admin of domain.com in another tab?

    Do you have any idea why it has lost admin priveleges for the sub domain blog?

    Thread Starter jorwesflow

    (@jorwesflow)

    okay, i used the wp-config.php file to ensure the URL’s are set correctly by adding these lines:

    define(‘WP_HOME’,’https://nightlife.bethany-ag.org&#8217;);
    define(‘WP_SITEURL’,’https://nightlife.bethany-ag.org&#8217;);

    i also used a different browser to make sure i was not logged into the admin for https://www.bethany-ag.org and tried to log into the admin for nightlife.bethany-ag.org and kept getting the same problem.

    anything else you want me to try?

    Thread Starter jorwesflow

    (@jorwesflow)

    ok, so I went in and reset the database for the wordpress settings. the site URL’s are back to the default (bethany-ag.org/nightlife/). i have regained admin access. i’m back to square one. bethany-ag.org/nightlife/ now loads properly.

    so apparently, after speaking to my host, my subdomain (nightlife.bethany-ag.org) doesn’t “use” any directory in the state that it’s set up. it just points to the IP of the main URL (bethany-ag.org). they said that’s what the 301 redirect in the .htaccess is for, to point nightlife.bethany-ag.org to the sub-directory where the site sits (bethany-ag.org/nightlife/)

    still confused… wordpress is sitting in bethany-ag.org/nightlife/ All I want to do is share the website to people with the subdomain: “nightlife.bethany-ag.org” instead of the subdirectory. i never want “bethany-ag.org/nightlife/” to appear in the browser address bar, even though that’s where the WordPress install sits.

    is that enough information to get some more specific instruction here?

    I hope I am asking this question to the right forum.

    I host my WP website and the domain name in domainname.com all subdomain names end in .php for example domainname.com/sumbomainname.php

    The programmers who set up my site have installed redirect instructions to redirect numerous subdomainnames to other subdomain names and to the home. However, I no longer work with them. Long story.

    I want to redirect a misnamed subdomain to the home page.

    For example we already redirect domainname.com/subdomain.php to the home (domainname.com/index.php) page correctly. But now I want to redirect domainname.com/subdomain to domainname.com/index.php

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    @hawkeye21, you are in the right sub-forum but could you please start your own thread?

    It’s the best way to get attention on your specific issue.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘htaccess redirect subdomain’ is closed to new replies.