Reputation: 973
I've just uploaded my website from my local server (XAMPP). It was working locally, but for some reason the rewrite to add index.php to my SEF URL's is not working in my public server. This is what I've got right now:
# Avoid listing directory
Options -Indexes
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
# manage language segment
RewriteRule ^(es|en)/(.*) $2?lang=$1 [L]
# code that allows to get rid of index.php from URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
</IfModule>
These URL's work:
www.example.com
www.example.com/index.php/aboutme
while URL's like this generate a 500 error:
www.example.com/aboutme
Here's another combination of condition and rule I tried to solve the index.php removal:
RewriteCond $1 !^(index.php|css|img|scripts|ckeditor|robots.txt|sitemap.xml)
RewriteRule ^(.*)$ index.php/$1 [L]
But it generates a 500 error for any URL without index.php, including the root URL www.example.com
Could you help me fix this?
Upvotes: 0
Views: 540
Reputation: 158
There seems to be a typo in your RewriteRule.
Try this:
RewriteCond $1 !^(index.php|css|img|scripts|ckeditor|robots.txt|sitemap.xml)
RewriteRule ^(.*)$ /index.php/$1 [L]
It works for us with Code Igniter. The only difference is the slash infront of index.php when compared to your second examples.
Upvotes: 2