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

How do you change the URL for the home page so it returns the URL/URLsegment rather than "/" when you do $BaseURL


Go to End


974 Views

Avatar
LiamC

Community Member, 2 Posts

23 August 2017 at 11:49pm

I have a contact form on the homepage that on my form action I get a 404 error because where im saying $Page its seeing Page as "/" rather than the actual URL segment.
The form works fine on every other page because it has the URL segment in the URL.

I have block widgets with a custom block builder I use. So my home page has many blocks so the form is within BlockWidgetBanner hense why the action goes out of the row to the page. Page is read as "/" rather than "home".

<form action="{$PageBlockRow.Page.Link}sendForm">
<input type="text" name="name" placeholder="Your name" required>
<input type="text" name="email" placeholder="Your email" required>
<input type="text" name="number" placeholder="Your phone number" required>
<input type="hidden" name="formID" value="$ID">
<input type="submit" value="Submit" class="btn button">
</form>