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

Changing the homepage


Go to End


5 Posts   1147 Views

Avatar
Stef87

Community Member, 66 Posts

5 December 2012 at 3:58am

SilverStripe 2.4.7

Hi

I have implemented a method which outputs html and I call it this way. www.mysite.com/myclass/html

My client has now decided that they want this page displayed as the homepage so when a user types in www.mysite.com it will come up. Is there a way I can achieve this in SilverStripe? I know that I can use Redirector pages but that doesn't mask the URL.

Thanks

Avatar
Double-A-Ron

Community Member, 607 Posts

5 December 2012 at 12:07pm

So how do you want the URL to act exactly?

If I type in www.mysite.com, do you want me redirect to www.mysite.com/myclass/html? Or do you just want the content from the latter to display without the URL changing?

Avatar
Stef87

Community Member, 66 Posts

5 December 2012 at 9:58pm

Hi Double-A-Ron

Thanks for replying so quick. I want the content from the latter to display without the URL changing. Sorry if this is a really obvious question, it has me stumped though.

Thanks

Avatar
Double-A-Ron

Community Member, 607 Posts

5 December 2012 at 10:17pm

Is the method you speak of at www.mysite.com/myclass/html a Silverstripe page or plain PHP?

Personally, I would simply port that page into your /mysite/code/HomePage.php classes so your homepage becomes a replica of the page above.

You can use htaccess to redirect traffic hitting the homepage to a particular URL, but the URL will change as a result.

Avatar
Stef87

Community Member, 66 Posts

5 December 2012 at 10:23pm

It's a SilverStripe page with a method in the controller. I have to parse HTML before it is displayed so I wasn't sure how else to do it. Ok, I'll transfer it all to a HomePage. Thanks for your help. :)