Hi all,
My first post here and hoping this will lead to a helpful result for many who are adopting LiteSpeed Enterprise on Cloudlinux Cpanel from Apache with an existing website with RewriteRule in Htaccess file in public_html.
So I installed LiteSpeed Enterprise and tried to get the below htaccess rules working. I have edited this down for privacy and also included only one type for each rule in the below example.
HTAccess rules - unchanged from apache start
Options +FollowSymLinks
RewriteEngine on
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^/?$ "https\:\/\/www\.domain\.com\/" [R=301,L]
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "www.staticdomain.co.uk"
</IfModule>
RewriteRule ^.well-known/apple-app-site-association$ .well-known/apple-app-site-association.p7c [L]
RewriteRule ^oldfilepath?$ https://www.domain.com/newfilepath [R=301,L]
RewriteRule ^newfilepath/?$ oldfilepath.php [NC,L]
RewriteRule ^newfilepath/([^/]+)/([^/]+)/?$ oldfilepath.php?variable1=$1&variable2=$2&variable3=1 [L,QSA]
RewriteRule ^newfilepath$ /oldfilepath.php? [L]
RewriteRule ^newfilepath$ /oldfilepath.php?
<filesMatch ".(ico|jpg|jpeg|png|gif|webp|woff|woff2)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
<filesMatch ".(css|js|scss)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
HTAccess rules - unchanged from apache end
I have read that the below
RewriteRule ^oldfilepath?$ https://www.domain.com/newfilepath [R=301,L]
should be amended to the below adding a / before the ^
RewriteRule ^/oldfilepath?$ https://www.domain.com/newfilepath [R=301,L]
I think I am also missing something with the below?
Options +FollowSymLinks
RewriteEngine on
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^/?$ "https\:\/\/www\.domain\.com\/" [R=301,L]
Any and all help is so appreciated!
My first post here and hoping this will lead to a helpful result for many who are adopting LiteSpeed Enterprise on Cloudlinux Cpanel from Apache with an existing website with RewriteRule in Htaccess file in public_html.
So I installed LiteSpeed Enterprise and tried to get the below htaccess rules working. I have edited this down for privacy and also included only one type for each rule in the below example.
HTAccess rules - unchanged from apache start
Options +FollowSymLinks
RewriteEngine on
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^/?$ "https\:\/\/www\.domain\.com\/" [R=301,L]
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "www.staticdomain.co.uk"
</IfModule>
RewriteRule ^.well-known/apple-app-site-association$ .well-known/apple-app-site-association.p7c [L]
RewriteRule ^oldfilepath?$ https://www.domain.com/newfilepath [R=301,L]
RewriteRule ^newfilepath/?$ oldfilepath.php [NC,L]
RewriteRule ^newfilepath/([^/]+)/([^/]+)/?$ oldfilepath.php?variable1=$1&variable2=$2&variable3=1 [L,QSA]
RewriteRule ^newfilepath$ /oldfilepath.php? [L]
RewriteRule ^newfilepath$ /oldfilepath.php?
<filesMatch ".(ico|jpg|jpeg|png|gif|webp|woff|woff2)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
<filesMatch ".(css|js|scss)$">
Header set Cache-Control "max-age=31536000, public"
</filesMatch>
HTAccess rules - unchanged from apache end
I have read that the below
RewriteRule ^oldfilepath?$ https://www.domain.com/newfilepath [R=301,L]
should be amended to the below adding a / before the ^
RewriteRule ^/oldfilepath?$ https://www.domain.com/newfilepath [R=301,L]
I think I am also missing something with the below?
Options +FollowSymLinks
RewriteEngine on
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^/?$ "https\:\/\/www\.domain\.com\/" [R=301,L]
Any and all help is so appreciated!