Go Back   Website Hosting - VPS Hosting - Domain Registration Ireland :: Blacknight > Technical Support > Direct Admin - Shared Linux

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-04-08, 07:59 PM
Junior Member
 
Join Date: Apr 2008
Posts: 12
Default Drupal clean urls .htaccess

Hi
I'm trying to enable clean urls in my Drupal installation.
I've have tried adding these lines to the .htaccess file in my public_html directory:

LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c

as per the Drupal help, but it just causes a server error.
Using latest version of Drupal.

Where exactly in the .htaccess file should I add those lines, or what else should I do?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 06-04-08, 08:08 PM
Administrator
Site Admin
 
Join Date: Aug 2003
Posts: 181
Default

Hi Rowan,

The rewrite engine is included by default on all our linux plans. You should just add your re-write rules to your .htaccess file.

Paul
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-04-08, 08:19 PM
Junior Member
 
Join Date: Apr 2008
Posts: 12
Default

I did add these rewrite rules, taken from the drupal help on clean urls

LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c

to my .htaccess file, but it just causes a server error.

Am I adding the right lines?

I also tried adding

<Directory /var/www/mysite.com>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</Directory>

But this also caused a server error
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-04-08, 08:24 PM
Administrator
Site Admin
 
Join Date: Aug 2003
Posts: 181
Default

Hi Rowan,

Thats an example that they give. In your .htaccess file you should only have the following:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Neither the load modules or <Directory> directives are required when you use your .htaccess file.

Paul
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-04-08, 08:37 PM
Junior Member
 
Join Date: Apr 2008
Posts: 12
Default

Ok thanks for your help
I put those lines into .htaccess

I tried both inside and outside the tags
<IfModule mod_rewrite.c>
...
</IfModule>

And made sure there's nothing else to do with rewrite.

Now it doesn't give a server error, but still drupal won't let me enable clean urls
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 06-04-08, 09:30 PM
blacknight's Avatar
Administrator
Site Admin
 
Join Date: Aug 2003
Location: Ireland
Posts: 612
Send a message via ICQ to blacknight
Default

You shouldn't need to add anything except the snippet Paul gave you, namely:
Code:
    RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
This assumes you have installed Drupal in your root ie. that it is available by going directly to your site
__________________
Please do not send me PMs for support issues - thanks for your understanding.
Blacknight Blog | VPS Hosting| Blacknight Technical Status Blog | Hosting Wiki |Speed Test|Webmaster Chat |Personal Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-04-08, 08:47 PM
Junior Member
 
Join Date: Apr 2008
Posts: 12
Default

Still no joy.

I've installed drupal in this directory on the server:
/domains/mydomain.com/public_html/

i haven't transferred my dns over just yet (until i get the site ready) so in the browser i go to
http://rivalin.blacknight.ie/~myusername/

as this corresponds to the /public_html/ directory above

Is that the right directory?

Here's my .htaccess, its unchanged from the latest drupal version except for your additions:

Code:
#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
  php_value mbstring.http_input             pass
  php_value mbstring.http_output            pass
  php_value mbstring.encoding_translation   0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On

  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600

  # Do not cache dynamically generated pages.
  ExpiresByType text/html A1
</IfModule>


RewriteEngine on
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


# Various rewrite rules.
<IfModule mod_rewrite.c>
  #RewriteEngine on

  # If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment and adapt the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

  # Modify the RewriteBase if you are using Drupal in a subdirectory or in a
  # VirtualDocumentRoot and the rewrite rules are not working properly.
  # For example if your site is at http://example.com/drupal uncomment and
  # modify the following line:
  # RewriteBase /drupal
  #
  # If your site is running in a VirtualDocumentRoot at http://example.com/,
  # uncomment the following line:
  # RewriteBase /

  # 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>

# $Id: .htaccess,v 1.90 2007/10/05 14:43:23 dries Exp $
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 08-04-08, 09:10 AM
Blacknight Staff
 
Join Date: Nov 2006
Posts: 54
Default

Hi Rowan,

The rewrites you put in the .htaccess file won't work correctly if you aren't using the domain name to access the site. The rewrites won't work using the temporary address.

The best way to test the site before you point the domain to it is through putting the domain into your hosts file. You can see more on how to do this here:
https://support.blacknight.ie/index....barticleid=169
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 09-04-08, 08:25 PM
Junior Member
 
Join Date: Apr 2008
Posts: 12
Default

I can't determine the ip address of my temporary site
rivalin.blacknight.ie/~rowan/

Ping can't get it, Find IP address of a website - server ip lookup can't get it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 09-04-08, 09:50 PM
Junior Member
 
Join Date: Apr 2008
Posts: 3
Default

Hi rowan,

You need to ping everything before the / - in this case, just rivalin.blacknight.ie, whose IP address is 81.17.252.145

~ > ping rivalin.blacknight.ie
PING rivalin.blacknight.ie (81.17.252.145) 56(84) bytes of data.
64 bytes from rivalin.blacknight.ie (81.17.252.145): icmp_seq=1 ttl=56 time=5.47 ms
64 bytes from rivalin.blacknight.ie (81.17.252.145): icmp_seq=2 ttl=56 time=5.30 ms
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
clean, drupal, htaccess, urls

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:01 PM.


VPS Hosting Web Hosting Ireland Blacknight Blog Blacknight Status

Powered by: vBulletin Version 3.7.3, Copyright ©2000 - 2010, Jelsoft Enterprises Limited.
Blacknight 2005 - 2009 | VPS Hosting | Wiki

SEO by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17