Drupal 8.5.4 all links give 404 Not Found

后端 未结 3 1818
刺人心
刺人心 2021-01-27 00:44

I am using Ubuntu 18.04 server and Drupal 8.5.4. The installation was successful.I can login and my home page is displayed . But any other url on the page gives error. One such

相关标签:
3条回答
  • 2021-01-27 00:52

    Now, Need to activate mod_rewrite:

    sudo a2enmod rewrite

    This will activate the module or alert you that the module is already in effect. To put these changes into effect, restart Apache:

    sudo service apache2 restart

    0 讨论(0)
  • 2021-01-27 00:52

    There are two things

    1: Ensure that mod_rewrite is enabled To check this create a file called phpinfo.php in the root of your site. This file should be accessible from a web browser and contain this code:

    phpinfo();
    

    Navigate to phpinfo.php in a browser like this: http://www.example.com/phpinfo.php

    On that page, look for a section called "Loaded Modules" and check that mod_rewrite is included. If not, mod_rewrite is not being loaded by apache and will need to be enabled. To enable this mode just write the following command in terminal and restart the apache

    sudo a2enmod rewrite
    

    2:Ensure that Drupal's .htaccess file is being used Once it's been confirmed that mod_rewrite is enabled, double check that Drupal's .htaccess file is in the site's root, and that it is working. Confirm that .htaccess is enabled by temporarily replacing Drupal's .htaccess file. Make a backup of the existing .htaccess and create one like this

    DirectoryIndex phpinfo.php
    

    Now try the site URL without specifing a page or file in a web browser: http://www.example.com/. If you see PHP's phpinfo dump, the .htaccess file worked and you can restore the old one. If not, the server may not be allowing .htaccess overrides for your site.To allow this edit you virtual hosting file or apache2.conf file. For apache2.conf file change

    <Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None        
    

    to

    <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
    

    Restart the apache and hopefully site works well

    0 讨论(0)
  • 2021-01-27 01:12
    I changed 
    
    <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
    
    to 
    
    <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    

    in /etc/apache2/apach2.conf , restarted Apache with service apache2 restart

    0 讨论(0)
提交回复
热议问题