LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Apache Migration/Compatibility > htaccess Rewrite question: file renaming

Reply
 
Thread Tools Display Modes
  #11  
Old 07-29-2010, 03:30 PM
frankvh frankvh is offline
New Member
 
Join Date: Jul 2010
Posts: 8
Ah!

Thank you. Point well taken. So this doesn't work too well in practice for index files, because unless you specifically type in the index.html extension (and who does that?? I just type cnn.com when I want cnn for example) then it doesn't work.

OK, thank you, that makes sense. So this is not the right path to be going down.

I think I'm going to experiment with a cron job.
Reply With Quote
  #12  
Old 07-29-2010, 04:23 PM
frankvh frankvh is offline
New Member
 
Join Date: Jul 2010
Posts: 8
So as we'd expect, a cron job does the trick. Perhaps not the most elegant, but it works. The cron job copies index.html to index.php. Then in .htaccess, just to be safe, I put this:

DirectoryIndex index.php index.html

simply to be extra-sure that the php file would be used in preference to the html file.

I used the -u parameter for cp (ie: cp -u index.html index.php) just to prevent unnecessary overwrites of the php file.
Reply With Quote
  #13  
Old 07-29-2010, 08:06 PM
NiteWave NiteWave is online now
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
I tested
Quote:
RewriteEngine on
RewriteRule index.html - [T=application/x-httpd-php]
as well. it works.

another way I tried working is to create a hard link(not soft symbol link):
Quote:
ln index.html index.php
with this method cron job not needed.
Reply With Quote
  #14  
Old 07-29-2010, 09:14 PM
frankvh frankvh is offline
New Member
 
Join Date: Jul 2010
Posts: 8
Yes, sort-of. I tried your suggestion:

Quote:
RewriteEngine on
RewriteRule index.html - [T=application/x-httpd-php]
It does indeed work if I do this:
http://frankandcolleen.mydomain.com/index.html

But not if I do this (which unfortunately is the normal way of doing it)
http://frankandcolleen.mydomain.com

I'm not sure why the server makes a distinction between these two cases, but it obviously does.


Your hard link idea
Quote:
ln index.html index.php
is a great idea - I'll do that. As you point out, then the cron job isn't needed anymore.
Reply With Quote
  #15  
Old 07-30-2010, 11:59 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,585
add another rewrite rule

RewriteRule ^$ index.html

above
Reply With Quote
Reply

Tags
htaccess, mod_rewrite, rewrite

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:56 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.