search

Home  >  Q&A  >  body text

wordpress - apache2 modifies the root directory under ubuntu14.04, causing wrodpress to be unusable

WordPress is built using apache2+php+mysq under ubuntu14.04. But I did not modify the root directory of apache2. Today, after changing the root directory of apache2 to the directory where iwordpress is located, I found that wordpress suddenly became unusable.
This is what it looked like before the modification

Then this is what it looks like after modifying the root directory. Clicking any link will result in 404 no found

The previous root directory is the default root directory

My wordpress is installed under the original root directory, so I added /wordpress directly to the end of the directory behind documentroot

I want to know why this is happening? What should I do so that I can directly access my wordpress website after entering the domain name? Thanks

PHP中文网PHP中文网2749 days ago770

reply all(3)I'll reply

  • 巴扎黑

    巴扎黑2017-05-16 17:00:57

    I don’t know if you have solved this problem. I just registered segmentfault yesterday, so I didn't see your problem earlier. I encountered similar problems to you in the past. You have not successfully changed the file root directory of apache - changing the root directory of apache requires changing two files, one is /etc/apache2/sites-available/000-default.conf (you changed this), and the other One is /etc/apache2/apache2.conf (you missed this one).
    What you need to do is change what I call the second configuration file:
    vim /etc/apache2/apache2.conf
    Then press i to enter edit mode, scroll down (remember it should be very far back...) to find

    <Directory /var/www/>
           Options Indexes FollowSymLinks
           AllowOverride None
           Require all granted
    </Directory>

    Change it to

    <Directory /var/www/wordpress>
           Options Indexes FollowSymLinks
           AllowOverride All  //改成All是为了开启Rewrite模式
           Require all granted
    </Directory>

    That should be enough, I hope it helps.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:00:57

    1. Are directory permissions allocated appropriately?

    2. Look at the screenshot, you can enter the homepage, but other pages are 404, it may be that rewrite is not turned on, the root directory of the website may need an .htaccess file to configure rewirte

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-16 17:00:57

    In fact, your domain name directory configuration should not put wordpress under ../html/, but under /var/www/, and then configure the root directory in site-avaliable to /var/www/wordpress, like this If so, there will be no problem with the style not coming out

    reply
    0
  • Cancelreply