apache - CodeIgniter: How to disable "index.php" in URLs completely (disallow it if manually entered in URL) -
i'm using codeigniter , have been able use url's without "index.php" in there, if manually type in "index.php", urls still work. i'd disable access "index.php/controller" type urls in order avoid duplicate content penalty google.
here current .htaccess file looks like:
options +followsymlinks # turn on url rewriting rewriteengine on # installation directory rewritebase / # protect hidden files being viewed <files .*> order deny,allow deny </files> # protect application , system files being viewed rewriterule ^(?:application|modules|system)\b.* index.php/$0 [l] # allow files or directories exist displayed directly rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # rewrite other urls index.php/url rewriterule .* index.php/$0 [pt]
you can try replacing last 3 lines this
rewritecond $1 !^(index\.php|robots\.txt) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l,qsa]
or maybe removing last line of .htaccess.
also might need change /config/config.php to
$config['index_page'] = “”
Comments
Post a Comment