| |||
|
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? |
| |||
|
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 |
| |||
|
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 |
| |||
|
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 |
| ||||
|
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]
__________________ 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 |
| |||
|
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 $
|
| |||
|
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 |
| |||
|
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. |
| |||
|
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 |