htaccess and index.htm

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
bdconnolly
Regular
Posts: 140
Joined: Tue Apr 04, 2006 9:37 pm

htaccess and index.htm

Post by bdconnolly »

Can I use an index.html page aside of the index.php?

Background: I am trying to set up a dynamic splash screen: see http://www.dynamicdrive.com/dynamicinde ... splash.htm .

I am guessing that my mod_rewrite and .htaccess setup is making that difficult.

I've included my .htaccess below. Thoughts?

Tried "DirectoryIndex index.htm /index.php" but no luck.

Brian

Code: Select all

# BEGIN s9y
php_value memory_limit 16M 
ErrorDocument 404 /index.php
DirectoryIndex /index.php
php_value session.use_trans_sid 0
php_value register_globals off

RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_USER_AGENT} !FeedBurner.*$
RewriteRule ^feeds/.*$ http://feeds.feedburner.com/Strumpette [R=permanent,L] RewriteCond %{HTTP_USER_AGENT} !FeedBurner.*$ RewriteRule ^(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$ http://feeds.feedburner.com/Strumpette [R=permanent,L]

RewriteRule ^(archives/([0-9]+)-[0-9a-z\.\_!;,\+\-]+\.html) index.php?/$1 [NC,L,QSA] RewriteRule ^(authors/([0-9]+)-[0-9a-z\.\_!;,\+\-]+) index.php?/$1 [NC,L,QSA] RewriteRule ^(feeds/categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-]+\.rss) index.php?/$1 [NC,L,QSA] RewriteRule ^(feeds/authors/([0-9]+)-[0-9a-z\.\_!;,\+\-]+\.rss) index.php?/$1 [NC,L,QSA] RewriteRule ^(categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-]+) index.php?/$1 [NC,L,QSA] RewriteRule ^archives([/A-Za-z0-9]+)\.html index.php?url=/archives/$1.html [NC,L,QSA] RewriteRule ^([0-9]+)[_\-][0-9a-z_\-]*\.html index.php?url=$1-article.html [L,NC,QSA] RewriteRule ^feeds/(.*) index.php?url=/feeds/$1 [L,QSA] RewriteRule ^unsubscribe/(.*)/([0-9]+) index.php?url=/unsubscribe/$1/$2 [L,QSA] RewriteRule ^approve/(.*)/(.*)/([0-9]+) index.php?url=approve/$1/$2/$3 [L,QSA] RewriteRule ^delete/(.*)/(.*)/([0-9]+) index.php?url=delete/$1/$2/$3 [L,QSA] RewriteRule ^(admin|entries)(/.+)? index.php?url=admin/ [L,QSA] RewriteRule ^archive/? index.php?url=/archive [L,QSA] RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2 RewriteRule ^(plugin|plugin)/(.*) index.php?url=$1/$2 [L,QSA] RewriteRule ^search/(.*) index.php?url=/search/$1 [L,QSA] RewriteRule ^(serendipity\.css|serendipity_admin\.css) index.php?url=/$1 [L,QSA] RewriteRule ^index\.(html?|php.+) index.php?url=index.html [L,QSA] RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA] RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]

<Files *.tpl.php>
    deny from all
</Files>

<Files *.tpl>
    deny from all
</Files>

<Files *.sql>
    deny from all
</Files>

<Files *.inc.php>
    deny from all
</Files>

<Files *.db>
    deny from all
</Files>

# END s9y
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: htaccess and index.htm

Post by garvinhicking »

Hi!

If you used "index.htm" in your .htaccess, you sure saved your page as index.htm and not index.html, right? :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
bdconnolly
Regular
Posts: 140
Joined: Tue Apr 04, 2006 9:37 pm

Post by bdconnolly »

right.

index.htm does not work. immediately loads index.php.

BC
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Ah, now I see it. Because you're using mod_rewrite, s9y thinks that "index.htm" is a file of its own framework:

Code: Select all

RewriteRule ^index\.(html?|php.+) index.php?url=index.html
RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA] 
If you were using Apache Errorhandling, then the call to index.htm would succeed.

Thus, you would need to modify the mod_rewrite rules so that index.htm is accepted and not rewritten to index.php. I don't know how to do that, though.

What you could do is to rename your index.htm file to "index.xtml", and also define that in your variation of DirectoryIndex. You might also need to adapt your webserver to recognize ".xtml" as a valid Content-Type: text/html file, or try to specify that in the <meta> tag of the index.xtml file

Or you edit your .htaccess to add a rewrite condition to the two rewrite rules above to make sure that the request does not match your "index.html" call. I don't properly know how to do that, I would nead to research that, so you might need to ask for the proper rewritecondition on apache-specific forums or bribe someone to look it up for you ;)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
bdconnolly
Regular
Posts: 140
Joined: Tue Apr 04, 2006 9:37 pm

Post by bdconnolly »

I am totally confused.

This much I know: if Garvin can't do it, it probably can't be done or isn't worth doing.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Read it again, it can be done, of that I'm sure :-) :-)

Maybe for you it's easier to set a staticpage as frontpage of your blog and paste your javascript into that staticpage frontpage, instead of doing it outside of s9y?

If you put the s9y into a subdirectory of your host, you could create a root splash page that wouldn't affect s9y's rewriting...

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
bdconnolly
Regular
Posts: 140
Joined: Tue Apr 04, 2006 9:37 pm

Post by bdconnolly »

A little late in the game to move it now. Would that break like a gazillion links?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!
bdconnolly wrote:A little late in the game to move it now. Would that break like a gazillion links?
I'm afraid so, yes. You could add forwarding rules, but that would then mean more work for the server.

But the other option still applies to try the index.xtml approach, or the RewriteCond way...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
bdconnolly
Regular
Posts: 140
Joined: Tue Apr 04, 2006 9:37 pm

Post by bdconnolly »

Perhaps more trouble than it's worth. But I would be game to explore either option.

Which is easiest? What would you have me do? And how much of you professional time might that require?
Post Reply