WordPress in base.example.com and accessible from

2019-08-27 02:09发布

问题:

I have a WordPress installation at Subdomain. I wish to have the website display the site at example.com

The WordPress folder is located at base.example.com and the path is public_html/folder1/base.

If I run the site from the subdomain with home and site url pointing to base.example.com everything works fine. If I change the second url to my root example.com copying index.php (changing the path) and .htaccess to public_html/ I get the following issue:

  1. .htacces is not writable from wordpress
  2. tons of redirect issue
  3. admin bar disappear (solved here Admin bar doesn't appear on the front-end of a WordPress website)
  4. if I open the customizer I get errors (TEMPLATE ISSUE... with default wp themes everything works)
  5. Using USERPRO Plugin to manage my user after login I'm redirect to the default wordpress login page (that means there is something missed up in url redirect) EDIT: This is the path on the login page that appear after userpro login: http://base.exaple.com/wp-login.php?redirect_to=http%3A%2F%2Fbase.example.com%2Fwp-admin%2F&reauth=1 ... I'm still waiting for an answer from the author
  6. sometimes when I press logout it just reload the admin page.
  7. when I visit base.example.com I'm not redirect to example.com... is this right? it shouldn't redirect me instead?

Are 5 days that I'm trying to solve it so I also wrote to hostgator support because I think I did everything in the right way but they just say they can't support issue wich came from customization....but this is not a customization, is just making work a simple wordpress installation from a subdomain!!!

Hope you can help me!

EDIT

.htaccess (both in public_html/ and in public_html/folder1/base are the same)

# 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

index.php (in root)

require('./folder1/base/wp-blog-header.php');

index.php (in public_html/folder1/base)

require('./wp-blog-header.php');

EDIT 2

  1. I just get some 404 errors...

Updated question 4,5,6

  1. Your suggestion doesn't work. 301 redirect force wordpress to find his files in public_html instead the installation folder and obviously it can't find anything giving me an error. I've also changed the url form example.com to base.example.com but nothing!

I've tried to install wordpress in a simple subfolder and all the issue disappear but as I'm stubborn I want to achieve to make wordpress working in a subdomain instead a subfolder...

回答1:

  1. .htaccess being writable is not unusual, being that the site is in a different directory.
  2. Tons of redirect issues isn't a question, I would need an error to help you solve that problem.
  3. Solved by my answer at Admin bar doesn't appear on the front-end of a WordPress website.
  4. This isn't a question, I would need an error to help you solve that problem.
  5. You should contact the UserPro support team via their CodeCanyon account for support with their product.
  6. What error occurs when you are unable to logout? I would need an error to help you solve that problem.
  7. This is normal behavior. You can change this through a 301 redirect in your .htaccess within the root of the subdomain folder (not the root of your website). This code excludes /wp-content/* (for uploads access, plugins access, theme file access, etc.), /wp-admin/* (for admin access), and /wp-includes/* (for important WordPress includes access). Try this code and see what happens:

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/wp-content/
    RewriteCond %{REQUEST_URI} !^/wp-admin/
    RewriteCond %{REQUEST_URI} !^/wp-includes/
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]