Forum Moderators: phranque
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301]
But that is not working. That was putting "/cgi-bin/php5-cgi/" in my directory and returning a 500: Internal Server Error.
http://www.example.com/cgi-bin/php5-cgi/drupal-5.10/index.php?q=beerpongtournaments
[edited by: jdMorgan at 8:21 pm (utc) on Dec. 8, 2008]
[edit reason] Use example.com only, please. [/edit]
www.example.com/.htaccess
www.example.com/drupal-5.10/.htaccess
which .htaccess gets precedence?
--------------------------------------------------
This is the .htaccess inside the drupal folder:
--------------------------------------------------
<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>
Options -Indexes
Options +FollowSymLinks
ErrorDocument 404 /index.php
DirectoryIndex index.php
<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>
<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>
<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>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault A1209600
ExpiresByType text/html A1
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
# $Id: .htaccess,v 1.81.2.4 2008/01/22 09:01:39 drumm Exp $
/drupal-5.10/.htaccess takes precedence for URLs starting with /drupal-5.10
If RewriteOptions Inherit is set to "on", then /.htaccess will initially take precedence in the sense of executing first, but /drupal-5.10/.htaccess will be able to override some configuration settings if the resulting URL-path after /.htaccess execution still starts with /drupal-5.10
If RewriteOptions Inherit is set to "off", then /.htaccess will not execute for requested URL-paths starting with /drupal-5.10
*Some* agent is prepending the /cgi-bin/php5-cgi/drupal-5.10 filepath to your URL-path before your redirect is invoked. This could be mod_rewrite, mod_alias, mod_dir, or mod_negotiation -- in either your .htaccess files or in a server config file, or it could be one or more of your scripts. The problem could also be caused by a server-level misconfiguration. If adding the [L] flag doesn't help and you cannot find the cause, then lean on your host for more support.
Jim
Now my question is how do I redirect my users who have bookmarks or click on entries in the search engines?
I want to redirect them from:
http://www.example.com/durpal/ (with or without 'www')
To:
http://www.example.com
Would I place a rule before or after the 'www' rewriteRule? I have requested that Google take my results out for now because I don't want to keep getting a 404 error as that could hurt my rankings? What hurts my rankings more?
A good rule of thumb is this: All external redirects go first, in order from most-specific to least-specific, followed by all internal rewrites, again in order from most-specific to least-specific. Where two rules' RewriteRule and RewriteCond patterns are mutually-exclusive, the order won't matter.
Jim
RewriteCond %{HTTP_HOST} ^www\.example\.com/drupal\-5\.10$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
OR something like this?
RewriteRule ^/drupal-5.10$ /
I'm not clear on this. Also, I've deleted the drupal directory so putting an htaccess in there isn't an option unless I recreate it.