.htaccess issue in LiteSpeed Web Server

#1
Need help with litespeed web server .htaccess rules.

http://example.com/temp/home.php is existing URL, but now what we need to rewrite is mentioned below:

http://example.com/temp.php?redirect=home.php

And our Existing `.htaccess` code is also given below.

Code:
    RewriteEngine on<br/>
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
 
    RewriteRule ^temp/(.*)$ temp.php?redirect=$1 [QSA,L]
But I don't know the issue, this rewrite still not working and shows 404 error because temp/home.php does not exist.

These rules are working perfectly with Apache server, but not working with Litespeed

For reference:
https://htaccess.madewithlove.be?share=d15d3bca-6974-5682-902a-823c1a63e2b7


Thanks in advance.
 
Last edited by a moderator:

lucasrolff

Active Member
Staff member
#2
Hi @aravindkumarbalan,

I just replied to your question a few minutes ago on stackoverflow.com:

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^temp/(.*)$ temp.php?redirect=$1 [QSA,L]
The above code will serve the content of temp.php?redirect=home.php.

As a test I created temp.php in the root directory of a domain, with the content:

PHP:
<?php
var_dump($_GET);
The result when accessing /temp/home.php is:

Code:
array(1) {
  ["redirect"]=>
  string(8) "home.php"
}
This is tested on LiteSpeed Web Server 5.3.4 and 5.3.5.
Additionally, I tested with the app/home.php as you've supplied in the htaccess.madewithlove.be link, and also seems to be working as it should.
 
Top