Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]: htaccess lingo
#1

[eluser]Maglok[/eluser]
I have an CI application setup with the 'hide the index.php' htaccess, this works perfectly fine on my test environment (which is on the same server).

This is the htaccess:
Code:
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.html|index\.php|images|css|forum|xml|vertigo|symbols|scripts|favicon\.ico|robots\.txt|google847290c1a8337c56\.html|wip\.jpg)
RewriteRule ^(.*)$ ./index.php?/$1 [L]

I have included a index.html and wip.jpg on the list of things to not throw at index.php. If I go to domain.nl/index.html it does load, but it won't go to index.html by default.

I know of the command 'DirectoryIndex index.html' that should tell the webserver to serve the index.html page if it is available, yet that doesn't work. I basically want a (temporary) splash/puzzle before the index.php. It is giving me hell. Smile What am I missing?

The test environment htaccess is nearly the same only the rewritebase is /test/
#2

[eluser]coolgeek[/eluser]
Can't you do this with $route['default_controller'] in config/routes.php?
#3

[eluser]Maglok[/eluser]
Not really, because the page I am putting in front of the index.php is not in CI.

EDIT: Well I figured out the DirectoryIndex is technically working. The issue though is that the directoryIndex is not technically a request for 'index.html', so it reroutes it to 'index.php' (The CI entrance). My rewriteRule knowhow is really crappy, how do I get it to transfer the default page to index.html?
#4

[eluser]Tominator[/eluser]
If you change filename index.php to (for example) index_.php, is index.html loaded?
If yes you probaly have a problem with server configuration, and you have to add some lines to .htacces to say what is most important (.html or .php).
If not, the problem is probably in server configuration too, but maybe you have bad .htaccess (I am not really expert on .htaccess) and you are routes everything to index.php which is missing.

I'm student from Slovakia, so I am sorry for my poor English Smile
#5

[eluser]CroNiX[/eluser]
[quote author="Maglok" date="1268850701"]Not really, because the page I am putting in front of the index.php is not in CI.

EDIT: Well I figured out the DirectoryIndex is technically working. The issue though is that the directoryIndex is not technically a request for 'index.html', so it reroutes it to 'index.php' (The CI entrance). My rewriteRule knowhow is really crappy, how do I get it to transfer the default page to index.html?[/quote]
maybe just a redirect in htaccess for a empty url?

Code:
Redirect 301 / /somedir/non-ci-page-to-load.php

RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.html|index\.php|images|css|forum|xml|vertigo|symbols|scripts|favicon\.ico|robots\.txt|google847290c1a8337c56\.html|wip\.jpg)
RewriteRule ^(.*)$ ./index.php?/$1 [L]
#6

[eluser]Maglok[/eluser]
Thanks for the replies.

@Tominator: No if I change the name of the index.php it will still try to load index.php. It works correctly if I remove the rewriterule, but then I will be stuck with index.php in all urls.

@CroNiX: I get the concept, it just is not working. I tried adding the following things all before RewriteEngine on: (One at a time)
Code:
Redirect 301 / index.html
Redirect 301 / /index.html
Redirect 301 / ./index.html
Redirect 301 / index.html [L]
Redirect 301 / /index.html [L]
Redirect 301 / ./index.html [L]

Of those only the 3rd did something but throw a 500 error: "http://www.domain.nl/index.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.htmlindex.html?/" then it just quit cause it was looping.
#7

[eluser]Tominator[/eluser]
You may try add this line to the end:
RewriteRule index.html ./index.html [L]

I don't know if it works, but you can test it Smile
#8

[eluser]Maglok[/eluser]
I tried that aye, the problem with it is that if someone requests your domain, example: www.domain.nl, it doesnt count as a index.html request. Sad
#9

[eluser]billmce[/eluser]
What are the servers <Directory> settings for your site.
AllowOverride has to be set for .htaccess to work.
#10

[eluser]Maglok[/eluser]
htaccess works no problem. I have the index.php removal from the url perfectly, except that now I want index.html to come BEFORE CI. :/




Theme © iAndrew 2016 - Forum software by © MyBB