I am on Sitecore 9 update 1 , XP1 topology-Azure PaaS environment.
I am looking for an option of redirecting any Content Management URL to Experience Editor mode. It will redirect login if not logged in.
My CM instance has to be available over internet so I would like to have this flexibility.
I have an idea of doing it by "rewrite" under web.config by prepending sc_mode=edit
<rule name="Add sc mode edit" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{QUERY_STRING}" pattern="sc_mode=edit" negate="true" />
<add input="&{QUERY_STRING}" pattern="^(&.+)|^&$" />
</conditions>
<action type="Redirect" url="{R:0}?sc_mode=edit{C:1}" appendQueryString="false" />
</rule>
I already have below rewrite code in my web.config
<rewrite>
<rules>
<rule name="Root Hit Force HTTPS Redirection" enabled="true" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_METHOD}" pattern="GET" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/" redirectType="Permanent" />
</rule>
<rule name="Sitecore Login or Admin Force HTTPS Redirection" enabled="true" stopProcessing="true">
<match url="^(sitecore/(login|admin))$" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_METHOD}" pattern="GET" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
<rule name="Forbidden" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_METHOD}" pattern="GET" />
</conditions>
<action type="CustomResponse" statusCode="403" subStatusCode="0" />
</rule>
</rules>
</rewrite>
Combining both results in two rule for ".*" match ; and givs error in edit mode as "severe error contact Administrator" and none of the button or link click is working only above error just below Editor ribbon is coming.
Need suggestion on how to proceed on this or take some other route to achieve this.