So here is the situation
- Apache2 running in Ubuntu
- Multiple hosts in /var/www
- Two sites are drupal based
I have been reading about adding in 000-default or www.example.com.conf
AllowOverride All
Option +Indexes ... all that
but nothing works. Whenever I go to test for clean urls I get page cannot be found. I tried adding .htacess in /var/www/example.com but that didn't do anything either, it actually made it worst as nothing as coming up anymore...even when going to www.example.com I was getting 403 Permission Denied.
In the apache2 folder I have sites-available and sites-enabled, and it looks like the conf files are linked from one folder to the other, so it doesn't matter where I make the changes.
In /var/www there is a folder for each website I have as each domain name points to a particular folder (i.e. www.example.com points to /var/www/example)
I really don't know where to go from here and I would appreciate any help on this.
Thank you.
Comments
mod_rewrite?
do you have mod_rewrite enabled?
root#
a2enmod rewriteRewrite was already enabled #
Rewrite was already enabled
# a2enmod rewrite
This module is already enabled!
Hi Ciprian You can enable mod
Hi Ciprian
You can enable mod rewrite using .htaccess file. google how to enable mod rewrite using .htaccess and then you can find somt thing sure. if you still have some issues let me know I will google for you.
Cheers
The module is already enabled
The module is already enabled so should I still enable it through .htaccess?
no
no, the
.htaccesspackaged with Drupal already takes care of itRewriteEngine On, etc, etcAnother thing to add to
Another thing to add to this...
If I create an .htaccess file and put in:
# Various rewrite rules.
RewriteEngine on
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /var/www/example
# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]
# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]
# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA] #I put the slash in front on index as someone suggested that they got it going by putting it
my entire site goes into 403 Forbidden You don't have permission to access / on this server.
research
searched Google for
site:drupal.org "clean URLs"and the first hits are documentation pages at drupal.org- Clean URLs
- Setting up Clean URLs
- Clean URLs not working? Check your .htaccess file!
- etc
I've tried all those links
I've tried all those links and as soon as I put in .htaccess I get 403 Forbidden
Here is my .htaccess file:
# Various rewrite rules.
RewriteEngine on
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /
# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]
# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]
# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /?q=$1 [L,QSA]
The RewriteRule had index.php/?q=$1 before, but looking at what shows up when I go to the website, I didn't see index.php showing up. All I see is www.example.com/?q=about or whatever other page I'm on. So I took index.php out to give it a shot.
Here is the www.example.com.conf file (which is located in /etc/apache2/sites-enabled):
DocumentRoot /var/www/example/
ServerName www.example.com
AllowOverride All
Options Indexes
Thank you for helping me with this.
..
can you access http://example.com/example/?
Got it to work... a friend of
Got it to work... a friend of mine pointed out that I should put the following in my .htaccess file:
Order allow,deny
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
# Follow symbolic links in this directory.
Options +FollowSymLinks
# Set the default handler.
DirectoryIndex index.php index.html index.htm
After adding that, the 403 Forbidden went away and clean urls passed the test and was able to enable it.
Thank you for your help.
..
but Drupal comes with that in its
.htaccessyou should preserve the
.htaccessfile that comes with Drupalhow did you miss it?
..
EDIT: double post removed