2

I am trying to set up a local server to try out drupal 8.1.3 and so far I was able to set up my profile and website but I cannot go to any pages other than the first page. (Welcome page, front page)

I have used the following link to install Drupal:

https://www.howtoforge.com/tutorial/how-to-install-drupal_8-with-apache-and-ssl-on-ubuntu-15-10/

Few things to note:

  • I'm not sure if I have CleanURL, tried to fix this issue but couldn't succeed I believe.
  • I have tried multiple different approaches to fix issues like CleanURL, SSL connection, Apache2 (AllowOverride All) etc
  • I tried adding "?q=" and while this doesn't make the page crash, it just directs me back to the front page

Currently, I am playing around with four files to try to figure out my problem: ".htaccess", "apache2.conf", "drupal.conf" and "settings.php"

I want to be able to access the Drupal tools to modify the website and run it locally, I simply want to test Drupal, I wanted to share this because it may simplify the solution.

Some of the code that I have added while trying to fix my situation:

drupal.conf:

            <Directory "/var/www/drupal">
                    Options FollowSymLinks
                    AllowOverride All
                    Require all granted
            </Directory>

apache2.conf:

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

.htaccess:

RewriteBase /

# homepage redirect
RewriteRule ^$ /SUBDIRECTORY/index.php?q= [L]

# if directory or regular file...
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_URI} =/favicon.ico
# stop here
RewriteRule ^ - [L]

# if a regular file in SUBDIRECTORY directory
RewriteCond %{DOCUMENT_ROOT}/SUBDIRECTORY/%{REQUEST_URI} -f
RewriteRule .* SUBDIRECTORY/$0 [L]

# Redirect everything to /SUBDIRECTORY
RewriteRule .* /SUBDIRECTORY/index.php?q=$0 [QSA]

settings.php:

$settings['trusted_host_patterns'] = array(
  '^127.0.0.1$',
  '^localhost$',
  '^www.example.com$'
  );

PS. I have tried both localhost and an example website url like www.example.com but it didn't help. PS2. I am only using Firefox currently but I don't think the problem is with the browser.

I hope I was able to follow the question guidelines, I am really trying my best to make it a question "suitable" to the website, I am sorry if I made a mistake.

Edit1: I have rewrite already enabled.

3
  • This is not a Drupal problem. Make sure that url rewrite is enabled. If not, you can enable it by running this command sudo a2enmod rewrite then restart or reload your Apache conf by running sudo service apache2 restart. After that make sure that your Drupal clean URL is enabled.
    – Gulok
    Jun 27, 2016 at 21:32
  • 1
    Oh and you don't need to modify your .htaccess.
    – Gulok
    Jun 27, 2016 at 21:34
  • I have the rewrite already enabled. How can I make sure that the Drupal clean URL is enabled? Jun 28, 2016 at 2:04

1 Answer 1

2

I believe the problem was due to the location of my .htaccess file. (The main problem was the Clean URLs.)

My original location was /var/www/drupal/sites/default/files; after, I moved it to /var/www/drupal. The .htaccess file started to being read. Previously, it was not being read.

I hope this helps someone else! This also may not be the solution because I am having a different issue now.

1
  • The .htaccess needs to be placed in the Drupal root directory, to be used. In other words, it needs to be placed where the index.php file used by Drupal is. That is how Apache works.
    – apaderno
    Jun 28, 2016 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.