.htaccess redirect index.php / index only if directly after root URL? -


here part of .htaccess file,

rewritecond %{the_request} ^.*/index rewriterule ^(.*)index.php$ /$1 [l,r=301] 

i understand does, search , if end part ends in index remove it.

but have noticed if type address bar http://example.com/index/index, internal server error never good, , return 404, indeed directory index not or not exist.

how can change rule search if address http://example.com/index , rewrite?

thanks

try code:

options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase /  rewritecond %{the_request} ^[a-z]{3,}\s(.*?)/index\.php[?\s] [nc] rewriterule ^ /%1 [l,r=301] 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -