Welcome Guest, Not a member yet? Register   Sign In
Show 404 Page When User Types index.php within URL
#1

[eluser]fjamal[/eluser]
I need to show 404 page when user types index.php within the URL as:

Quote:http://localhost:8080/site_name/index.php/home
I add this in routes.php
Code:
$route['index.php/(:any)'] = 'custom404';

It didn't help.

I have the htaccess that allows me to remove index.php from url, but i also want to show 404 page in case user types index.php in URL manaully.

Any suggestions?

My htaccess:

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site_name/index.php/$1 [L]
#2

[eluser]Aken[/eluser]
I'd suggest not doing it in the first place.
#3

[eluser]fjamal[/eluser]
[quote author="Aken" date="1344672560"]I'd suggest not doing it in the first place. [/quote]

May i know why you don't recommend it?
#4

[eluser]fjamal[/eluser]
I might just use redirect via htaccess; the right solution.
#5

[eluser]Aken[/eluser]
If you ever need to disable your .htaccess rewrite that removes index.php, you'll need index.php to work so you can actually see your website still.

A redirect is an option, but if you don't link people to index.php in the first place, they'll never know the URL exists, unless they randomly punch it into their browser.




Theme © iAndrew 2016 - Forum software by © MyBB