
25th April 2005, 13:46
|
|
Junior Member
|
|
Join Date: Apr 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Drupal and Apache Rewrite Rules
Hi,
I've set up a Drupal-based web site. Drupal is right in the web server's document root. Now Drupal can generate search-engine friendly URLs ( www.domain.com/a/b/c instead of www.domain.com/index.php?1=a&2=b&3=c), but to use this feature I have to create a .htaccess file with Apache rewrite rules in the document root.
Drupal comes with a sample .htaccess file, but it's not working. The rewrite rules look like this:
Code:
# Various rewrite rules
<IfModule mod_rewrite.c>
RewriteEngine on
# Modify the RewriteBase if you are using Drupal in a subdirectory and the
# rewrite rules are not working properly:
#RewriteBase /drupal
# 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 URLs of the form 'index.php?q=x':
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
What's wrong here?
Andre
|

25th April 2005, 21:11
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,853
Thanks: 781
Thanked 1,558 Times in 1,477 Posts
|
|
Try this:
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
</IfModule>
(Note the / in front of index.php!)
|

26th April 2005, 11:39
|
|
Junior Member
|
|
Join Date: Apr 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have the same problem, but my Drupal is not in the document root, but in the subdirectory drupal. Does it make a difference (because falko's solution doesn't work for me...)?
Uli
|

26th April 2005, 15:48
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,853
Thanks: 781
Thanked 1,558 Times in 1,477 Posts
|
|
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /drupal/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
might work.
|

19th November 2005, 02:12
|
|
Junior Member
|
|
Join Date: Nov 2005
Location: Texas, US
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Clean URLs for Drupal??
Hi,
I am also trying desperately to enable Clean URLs for my drupal installation.
I have a fresh installation of ISPConfig 2.1.1 and have my drupal installation in /var/www/web1 ( www.10thdimens10n.com).
I have tried editing the .htaccess file according to above, however this only results in a 500 internal server error.
The drupal documentation for clean urls is here. http://drupal.org/node/15365 Could someone perhaps have a look?
in addition:
the output of /var/www/web1/.htaccess:
Code:
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<Files ~ "(\.(inc|module|pl|sh|sql|theme|engine|xtmpl)|Entries|Repositories|Root|scripts|updates)$">
Order deny,allow
Deny from all
</Files>
# Set some options.
Options -Indexes
Options +FollowSymLinks
# Customized error messages.
ErrorDocument 404 /index.php
# Set the default handler.
DirectoryIndex index.php
# Override PHP settings. More exist in sites/default/settings.php, but
# the following cannot be changed at runtime. The first IfModule is
# for Apache 1.3, the second for Apache 2.
<IfModule mod_php4.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
</IfModule>
<IfModule sapi_apache2.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
</IfModule>
# Reduce the time dynamically generated pages are cache-able.
<IfModule mod_expires.c>
ExpiresByType text/html A1
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
# RewriteBase /var/www/web1
# 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]
</IfModule>
Last edited by timbo; 19th November 2005 at 02:16.
|

19th November 2005, 02:15
|
|
Junior Member
|
|
Join Date: Nov 2005
Location: Texas, US
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
|
|
My apache2.conf file is too long to post here. let me know if and what part you might need to look at if any.
Thanks a truckload in advance. You guys rock.
|

19th November 2005, 04:15
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,853
Thanks: 781
Thanked 1,558 Times in 1,477 Posts
|
|
Quote:
|
Originally Posted by timbo
the output of /var/www/web1/.htaccess:
|
You are in the wrong folder. The correct folder to install Drupal is /var/www/web1/web.
|

19th November 2005, 05:19
|
|
Junior Member
|
|
Join Date: Nov 2005
Location: Texas, US
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Okay. Now I'm totally confused. Why is everything which is installed into the /var/www/web1/web folder mirrored into /var/www/web1?
When I move the file .htaccess from /var/www/web1 into /var/www/web1/web and point to my site, the server returns a 500 internal error. When I take it out out, the site works. What gives?
What is in that drupal .htaccess file that disagrees with my LAMP setup?
|

19th November 2005, 05:27
|
|
Junior Member
|
|
Join Date: Nov 2005
Location: Texas, US
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Got it!
I see now. I CREATED the .htaccess file using the code here:
Quote:
|
Originally Posted by falko
Try this:
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
</IfModule>
(Note the / in front of index.php!)
|
I thought you were telling him to add that to his existing .htaccess file.
My clean urls are working! Thanks!
tb
|

4th May 2006, 21:26
|
|
Junior Member
|
|
Join Date: May 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello, i have a big trouble to install drupal 4.7 (the latest one) on ISPConfig 2.2.1 on a Debian Sarge.
I get an 500 internal error when i put this f****** .htacces file in my root directory: /var/www/web1/web/.htacces
I have modified the .htacces file (putting a slash before index.php ...like Falko's previous post)
I have installed drupal directly under /var/www/web1/web (no sub-directoy).
Here is my log file: (under web1/log/error.log)
[Thu May 04 20:03:59 2006] [alert] [client 82.231.213.145] /var/www/web1/web/.htaccess: Options not allowed here
[Thu May 04 20:03:59 2006] [alert] [client 82.231.213.145] /var/www/web1/web/.htaccess: Options not allowed here
[Thu May 04 20:04:00 2006] [alert] [client 82.231.213.145] /var/www/web1/web/.htaccess: Options not allowed here
[Thu May 04 20:04:00 2006] [alert] [client 82.231.213.145] /var/www/web1/web/.htaccess: Options not allowed here
[Thu May 04 20:04:58 2006] [alert] [client 82.231.213.145] /var/www/web1/web/.htaccess: Options not allowed here
[Thu May 04 20:04:58 2006] [alert] [client 82.231.213.145] /var/www/web1/web/.htaccess: Options not allowed here
[Thu May 04 20:04:58 2006] [alert] [client 82.231.213.145] /var/www/web1/web/.htaccess: Options not allowed here
[Thu May 04 20:04:58 2006] [alert] [client 82.231.213.145] /var/www/web1/web/.htaccess: Options not allowed here
[Thu May 04 20:04:59 2006] [alert] [client 82.231.213.145] /var/www/web1/web/.htaccess: Options not allowed here
[Thu May 04 20:04:59 2006] [alert] [client 82.231.213.145] /var/www/web1/web/.htaccess: Options not allowed here
Thank's for your help !
I guess these is a option like AllowOverride All but i dont known where to put it (maybe in /etc/apache2... ?)
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 22:05.
|
Recent comments
13 hours 33 min ago
18 hours 48 min ago
19 hours 3 sec ago
19 hours 7 min ago
20 hours 9 min ago
22 hours 17 min ago
1 day 42 min ago
1 day 1 hour ago
1 day 1 hour ago
1 day 2 hours ago