I’m looking for some help in writing an .htaccess file. In addition to removing “index.php” from the URL on the front-end, for SEO purposes I’d also like to:
1. Remove “www” so all pages are served as “http://mydomain.com”
2. Remove trailing slashes
The following code seems to work OK for me:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond $1 !^(images|system|favicon\.ico|robots\.txt|sitemap\.xml|index\.php|index\.htm) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]However, I can’t access the control panel without including “index.php” in the URL, and links to thumbnail images in the control panel aren’t working. If anyone has a better, more efficient way of writing the .htaccess file to accomplish the above-stated goals I’d appreciate any suggestions.