I have a site built on ExpressionEngine (EE). By default, EE requires index.php
to be present in the first segment of the URL. To pretty up my URLs, I use a .htaccess RewriteRule:
# Remove index.php from ExpressionEngine URLs
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
The entire site is also served with SSL, which I accomplish with another RewriteRule:
# Force SSL
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]
Recently, the client asked to move their RSS feeds to Feedburner. However, Feedburner doesn't like https URLs, so I had to modify my SSL RewriteRule to not force SSL on feed pages:
# Force SSL except on RSS feeds
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/feeds/ [NC]
RewriteCond %{REQUEST_URI} !^/index\.php [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]
So my whole .htaccess file looks like this:
RewriteEngine On
RewriteBase /
# Force SSL except on RSS feeds
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/feeds/ [NC]
RewriteCond %{REQUEST_URI} !^/index\.php [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]
# Remove index.php from ExpressionEngine URLs
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
As soon as I added the feeds rule to the .htaccess file, however, Google stopped indexing the site's pages. The sitemap URL that's submitted to Google is /index.php/sitemap
, so I'm thinking that index.php
is playing a role here.
How can I adjust my .htaccess file to allow SSL on my feed pages, but not mess up Google's indexing?