I'm using litespeed on shared hosting (unfortunately), and I'm trying to use .htaccess to rewrite http to https NON www - and change domain.com/index
to domain.com/my-string
for SEO purposes.
This is working fine in Apache, and I didn't know my shared host was using Litespeed. I use the same .htaccess on litespeed which results in a 404, despite my filename being correct.
Here is my htaccess:
DirectoryIndex my-string.php
Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^$ my-string [L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule ^my-string$ /my-string.php [L]
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php56” package as the default “PHP” programming language.
<IfModule mime_module>
AddType application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
The bottom section was added by my host.
This is working correctly in Apache, performs the 301 redirect from http non www, or http www to https non www with my string at the end of the URL, instead of index.
My understanding was litespeed uses the same syntax as Apache, so why is this happening?