Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Index file for now


Reply


3 Posts   1365 Views

Avatar
dreamstudio

Community Member, 48 Posts

20 March 2009 at 10:28am

Is there a way to have an index.htm page show up as a "Coming soon" page which everyone views when they goto the URL.... but if i type in a page name i know works... ie about-us/ after the url it will work...

i tried allowing just my IP being able to view the site and everyone else got a maintenance file... however my client is looking at the site in progress as well and they are coming from many IP addresses on numorous machines and maintainting that would be hard work

Is it possible to have the URL goto index.html but allow us to type in a known address to goto that relevant page

Avatar
martimiz

Forum Moderator, 1105 Posts

20 March 2009 at 10:13pm

You could start by adding another line to your .htaccess file, right behind where it says: RewriteBase /. this could be someting like

RewriteRule ^$ index.html [L]

(I'm no htaccess expert, but this works for me). If you find you now can no longer reach your homepage from your site's menu, because it now too points to index.html, you need to (temporarily) change your homepage's URL in the backend, where it probably says something like

'http://www.yoursite.xx/home'

to

'http://www.yoursite.xx/something_different'

Avatar
martimiz

Forum Moderator, 1105 Posts

21 March 2009 at 10:09pm

Edited: 21/03/2009 10:11pm

Thought a bit further. This works in 2.3.0 on Linux: you could set the base directory for your site to some imaginary 'testingthis' directory, by putting this in the _config.php file of your site (provided your site resides in the root):

Director::setBaseURL('/testingthis/');

Then you could adapt your rewriteRules something like this (quick fix, no expert, see above :-) ):

RewriteCond %{REQUEST_URI} (\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteRule ^testingthis/(.*)$ $1 [L]

RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(/testingthis)(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%2&%{QUERY_STRING} [L]

You don't have to change the homepage url for this one. You can now call your site in /testingthis/, requesting the root of the site wil redirect to index.html, links to /testingthis/ will be created automatically, and all other pages will give a not found error. This has probably been done better - if so, please point me to it.