http-redirectwebpanelcentos6suphp

centos Web Panel (CWP) htaccess redirect issue (mod_rewrite)


I have recently installed centos cwp and ran to an issue with htaccess where it does not redirect correctly to the index.php file.

The code below is working offline on local host on Xampp and it actually redirect any url to index.php for the files that do not exist.

so if i have a file for estate.php and url is estate.php then it goes directly to the estate.php but if url is estate without .php then it goes to index.php however the issue with CWP is that in both cases it goes to estate.php meaning if url is estate it goes to estate.php and ignoring the index.php.

<IfModule mod_rewrite.c>


RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.    RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f     
RewriteCond %{REQUEST_FILENAME} !-d     
RewriteRule ^([^?]*)$ /index.php?path=$1 [NC,L,QSA]

</IfModule>

Solution

  • I found the solution as below: I had to add options(Multiviews) after RewriteEngine

    RewriteEngine On
    Options -Multiviews