Expand my Community achievements bar.

SOLVED

Redirect rule for WKND SPA landing page

Avatar

Level 2
Hi, I'm trying to write a redirect rule for SPA site which has a structure similar to the WKND SPA site. (/content/wknd-spa-react/us/en/home) When I hit the domain (http://wkndspa.local:8080), I need the PT rewrite rule to redirect to /content/wknd-spa-react/us/en/home. I've used the below rule. RewriteRule ^/?$ /content/wknd-spa-react/us/en/home.html [PT,L] But it's not working as http://wkndspa.local:8080/.model.json is triggered and throwing some console errors. How can I redirect the domain to a home landing page?
1 Accepted Solution

Avatar

Correct answer by
Level 6

Add the following rewrite rule to redirect requests from the root domain to the desired landing page:

 

RewriteEngine On
RewriteRule ^$ /content/wknd-spa-react/us/en/home [L,R=301]

The RewriteRule directive matches requests with an empty path (root domain) and redirects them to /content/wknd-spa-react/us/en/home. The R=301 flag indicates a permanent redirect, which is recommended to preserve SEO rankings and indicate to search engines that the redirection is permanent.

then restart apache service.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 6

Add the following rewrite rule to redirect requests from the root domain to the desired landing page:

 

RewriteEngine On
RewriteRule ^$ /content/wknd-spa-react/us/en/home [L,R=301]

The RewriteRule directive matches requests with an empty path (root domain) and redirects them to /content/wknd-spa-react/us/en/home. The R=301 flag indicates a permanent redirect, which is recommended to preserve SEO rankings and indicate to search engines that the redirection is permanent.

then restart apache service.