Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Leaving static index.html page in place during development
I am currently working on a Textpattern driven site for a client, building it directly on their live hosting. Is there a way to leave a static index.html file in place while I work in this, which has priority over the index.php file Textpattern uses?
So if visitors go to http://www.mysite.com/ they get the static ‘Coming soon’ holding page (index.html). And if I go to http://www.mysite.com/index.php directly I can see the Textpattern install and get the all URL routing that does when navigating through the Textpattern build?
I guess it’s something that can be done by adding some temporary rules in my .htaccess
file?
Offline
#2 2012-11-14 12:37:08
- Algaris
- Member
- From: England
- Registered: 2006-01-27
- Posts: 572
Re: Leaving static index.html page in place during development
I’ve used a static index.html in the past and it works fine loading that instead of the Textpattern install. I’ve never tried viewing index.php directly though so I can’t say for certain if it would work.
Offline
Re: Leaving static index.html page in place during development
An .htaccess DirectoryIndex
should work fine for this. From memory, index.html is loaded first anyway, but I guess it won’t hurt to explicitly set in case the httpd.conf file has been altered.
DirectoryIndex index.html index.php
should do the trick. You can then specify the PHP version in the URL to bypass the default rule.
EDIT: although since Textpattern’s .htaccess uses index.php you might not be able to do it at the file level. May have to alter the httpd.conf file if you can.
Last edited by Bloke (2012-11-14 12:52:44)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Leaving static index.html page in place during development
Thanks. That’s doesn’t work in this case – and I don’t have access to httpd.conf either on this job as someone else is hosting it.
Weirdly, on my own serve the httpd.conf has this rule:
DirectoryIndex index.html index.html.var index.shtml index.cfm index.php index.htm
But still the .php file takes preference over the .html file.
Offline
Re: Leaving static index.html page in place during development
You must erase htaccess on ther server because thers is a redirect rule on it, i work the same way, the only things is choosing a messy url scheme on pref to see links workings.
Offline
Re: Leaving static index.html page in place during development
philwareham wrote:
But still the .php file takes preference over the .html file.
Maybe the Textpattern rule:
RewriteRule ^(.*) index.php
is overriding it? Not at all sure how all this apache stuff fits together in terms of precedence. Poke and hope is my methodology.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: Leaving static index.html page in place during development
Brilliant, got it working now, thanks people.
So, the final solution is, while developing the site, comment out this in the .htaccess file:
#RewriteRule ^(.*) index.php
If the index.php file still takes precendence over index.html (or index.htm) add this rule:
DirectoryIndex index.html index.htm index.php
Then in your Textpattern preferences turn on messy URLs.
At the end of the development, remove your index.html file and revert the above back to their original state.
Cheers,
Phil
Offline
Re: Leaving static index.html page in place during development
isnt easier to just dont put htacces on your hosting and when finishing development upload the htaccess?
Offline
Re: Leaving static index.html page in place during development
Dragondz wrote:
isnt easier to just dont put htacces on your hosting and when finishing development upload the htaccess?
Well, I don’t just have Textpattern rules in my .htaccess file, so not for me. But that’s an option for others I guess.
Offline
Re: Leaving static index.html page in place during development
Or you could make a page template with the coming soon page and make it default, then create a section called home which is your home page, make this default when done.
This is a perfect example of where forcing a section to use a page would be useful… I never got around to testing the methods mentioned, but I will
Offline
Re: Leaving static index.html page in place during development
rvm_maintennance is what I got… I say remember that.
if you’re logged in to txp: you see the regular site, otherwise you see the “error_default” txp page which can be static.
Offline
#12 2012-11-14 22:55:52
- woof
- Member
- Registered: 2004-08-01
- Posts: 128
Re: Leaving static index.html page in place during development
Another method is to put the static index.html in a form and use rvm_privileged in your page templates to show it to anyone not logged in.
<txp:rvm_if_privileged level="1,2">
[development work]
<txp:else />
<txp:output_form form="my_static_index"/>
</txp:rvm_if_privileged>
I like to use this method because it allows me to add (and remove) access levels as the project develops (to allow a client to preview or add content for example) and once I’m ready to publish it’s just a matter of stripping four lines out of each page template
Offline