There is a problem with my .htaccess file. If I type in “website.com” it redirects me correctly to “www.website.com”, but if I type in “website.com/level1/level2” it redirects me to “www.website.com/index.php/level2” and gives me a 404 error.
Here is what I have in my .htacces file:
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
AddDefaultCharset UTF-8
#Redirect from website.com to www.website.com
RewriteCond %{HTTP_HOST} ^website\.com$ [NC]
RewriteRule ^(.*)$ http://www.website.com/$1 [L,R=301]
Any suggestion how to solve the issue?
Thank you.
I think what’s happening is that you are rewriting to
index.phpbefore you are doing the external redirect. If you switch the order of your RewriteRules, it should fix the problem. Try this:This way, the external redirect to
wwwis done first, and when the request comes back, the internalindex.phpis then applied, instead of the other way around.