I am using WAMP and I want to remove index.php
from my url and I used this code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
Then I had to change two lines as I moved my files to sub-directory OOP-Project
from:
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
and
RewriteRule ^(.*)$ /index.php/$1 [L]
to:
RewriteRule (.*?)index\.php/*(.*) OOP-Project/$1$2 [R=301,NE,L]
and
RewriteRule ^(.*)$ OOP-Project/index.php/$1 [L]
But, the changes are not taking effect although first time it worked! I tried adding syntax error and it showed the error. Surprisingly, when I moved my files to another folder say OOP-Project-1
, it worked. I did a lot of research and found this Changes to RewriteRule in .htaccess not taking effect But it didn't address the problem correctly.
Hope someone helps!