• Resolved WPtesting

    (@wptesting)


    My home page is located on “https://www.mydomain.com/home/” so i also have redirected “https://www.mydomain.com” to “https://www.mydomain.com/home/“. I’m having a site called “https://www.mydomain.com/mysite/” but if users want to visit this site by typing the url without “www” that means “mydomain.com/mysite/“, the page automatically redirects to the home page “https://www.mydomain.com/home/“.

    I guess the problem can be fixed by editing the .htaccess file. but don’t have any idea regarding this issue!

    Here is my .htaccess 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]

    Any idea?

Viewing 15 replies - 1 through 15 (of 19 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    How did you redirect non-www to www? I don’t see that in the htaccess you shared.

    Thread Starter WPtesting

    (@wptesting)

    I want to redirect non-www to www, it’s not redirecting. if i type “mydomain.com/any-site-name” without “www” it redirects me to the home page..that is “mydomain.com/home/” instead of opening the real page. that’s why i want “www” prefix to be added automatically, so that it will take users to the right place.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    so i also have redirected “https://www.mydomain.com” to “https://www.mydomain.com/home/”.

    I’m asking how you did THAT.

    Thread Starter WPtesting

    (@wptesting)

    Oh! That one.
    just setup a static page as Front page from “Reading Settings”. then i redirected that static page to that(https://www.mydomain.com/home/) location using a redirection plugin…

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Get rid of the plugin, get rid of the redirect.

    If you’re using a static front page, just make the HOME page the front page. You’re adding needless complications in here.

    Once you have that undone, check if the www and non-www versions redirect as they’re supposed to, because https://www.domain.com/site and domain.com/site should be the same if your server is set up correctly.

    Thread Starter WPtesting

    (@wptesting)

    Sorry I’m not getting you properly. I installed wordpress on my root. I want to setup a static html page as home page. How to do that?
    coz wordpress doesn’t allow me to set an external static page as Front page..

    Thread Starter WPtesting

    (@wptesting)

    Update:
    I also have deactivated the plugin but still “mydomain.com/any-site-name” redirects me to the home page.. ??

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Making a static front page involves NO redirection. You make the page and tell WP to use that as the / level page. If you want the content of HOME to be the first page people see, make that your static front page. Done.

    As for the redirect, did your server get set up so www and non www point to the same place? You may need to check your DNS settings, but also ask your host.

    Thread Starter WPtesting

    (@wptesting)

    I’ve pointed both www & non www to the same place and disabled that plugin, but still facing the same problem.
    I’ve uploaded an html(test.html) file on root directory and it’s working fine.. I mean both “www.mydomain.com/test.html” & “mydomain.com/test.html” point to the same location.

    So the problem is only inside the wordpress framework. what to do? :/

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I’ve pointed both www & non www to the same place

    How?

    Thread Starter WPtesting

    (@wptesting)

    Just by adding a CNAME record called “www” which points to “@“.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    What did you set the URL as in WordPress? https://www.domain.com or domain.com?

    Thread Starter WPtesting

    (@wptesting)

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Can you do this via an A name instead of a C name?

    Thread Starter WPtesting

    (@wptesting)

    Ya I tried it but no difference! ??

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Redirecting "mydomain.com/anything" to "www.mydomain.com/anything"’ is closed to new replies.