Jump to:

4938 Posts in 16484 Topics by 1490 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » Index file for now

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

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

Page: 1
Go to End
Author Topic: 1328 Views
  • dreamstudio
    Avatar
    Community Member
    48 Posts

    Index file for now Link to this post

    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

  • martimiz
    Avatar
    Forum Moderator
    1083 Posts

    Re: Index file for now Link to this post

    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'

  • martimiz
    Avatar
    Forum Moderator
    1083 Posts

    Re: Index file for now Link to this post

    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.

    1328 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.