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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

redirecting public to temporary holding/under construction page while I'm still able to test the actual silverstripe website in the background


Go to End


5 Posts   3479 Views

Avatar
TF-35Lightning

Community Member, 137 Posts

22 April 2010 at 1:33pm

Hi all I am trying to get my .htaccess to point to a temporary (under construction page) while allowing me to test the Silverstripe site in the background.

I found a post by willr relating to this http://www.silverstripe.org/general-questions/show/256493#post256493 and have tried his method but I can't seem to get it functioning, hoping someone might be able to take a peek at my updated .htaccess and see if they can see anything wrong...

heres my .htaccess http://pastie.org/private/s34el6woi1viqzdvxknpw

any help would be great,

Avatar
3dgoo

Community Member, 135 Posts

22 April 2010 at 6:59pm

Rather than messing with the .htaccess, what I would do is put the Silverstripe site into a subdirectory, and then just have the root directory index.html be the under construction page.

Then when you are ready to put the Silverstripe site live, you delete the index file, move the Silverstripe site out of the subdirectory, change one word in the .htaccess file, and you're done.

Avatar
TF-35Lightning

Community Member, 137 Posts

22 April 2010 at 10:34pm

ampedup yeah I've done something similar, used a subdomain and do the testing there.

Avatar
3dgoo

Community Member, 135 Posts

23 April 2010 at 1:14pm

Edited: 23/04/2010 1:23pm

Cool. I've had a look at how to do this, and what the problems might be.

Firstly you need to remove comments like this <!--- LINK TO YOUR TEMP PAGE FILE. They break the .htaccess file

Secondly, you need to keep in the original Rewrite stuff, to make sure that silverstripe will still process for you:

RewriteEngine On

RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$) 

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]

So your .htaccess file should look something like this:

### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$) 

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]


RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_HOST} !^888.888.888.88
RewriteRule $ /maintenance.html [R=302,L]

</IfModule>
### SILVERSTRIPE END ###

Hope this helps/works

Avatar
TF-35Lightning

Community Member, 137 Posts

23 April 2010 at 1:50pm

Hi ampedup, yeah I did end up pickup up those few errors and got to the point where I could allow access via IP, but that is not much use to your clients for when they test and I don't know their individual IP's etc. So going the subdomain way is much better.