I can't enable Clean URLs in my site with the default .htaccess
The default .htaccess that Drupal 7 has is:
RewriteRule ^ index.php [L]
I have to change it that line to the one in Drupal 6:
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Since D7 have this comment:
Clean URLs are handled in drupal_environment_initialize().
I'm not sure where is the exact problem...
The configuration of my site is that I have in my hosting account my primary domain in a folder inside public_html, not in the root of that folder. To do that I had to create a .htaccess in the root of public_html that "change" the path of my domain to a subfolder... something like this:
public_html/
.htaccess <- to jump into mysite subfolder...
mysite/
.htaccess <- D7 one
The .htaccess I have is provided my my hosting company with the followin content:
******************************************
# Do not change this line.
RewriteEngine on
# Change yourdomain.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
# Change 'subfolder' to be the folder you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/mysite/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subfolder' to be the folder you will use for your main domain.
RewriteRule ^(.*)$ /mysite/$1
# Change yourdomain.com to be your main domain again.
# Change 'subfolder' to be the folder you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^(/)?$ mysite/index.php [L]
***********************************************
Sice this worked ok in D6 (using the line I change) I'm not sure if this is a bug in D7.
I can provide more feedback if needed.
Comments
Comment #1
jorsol commentedComment #2
dddave commentedNormally this works fine so the problem stems from the modified file provided by your hosting company. Check the original htaccess from a download here and look for differences.