I currently have a custom SEO-friendly RequestMapper with the following snippet:
@Override public final IRequestHandler mapRequest(Request request) { try { final String userAgent = ((HttpServletRequest) request.getContainerRequest()).getHeader("User-Agent"); final RedirectPolicy redirectPolicy = userAgent != null && BotUtils.isBot(userAgent) ? RedirectPolicy.NEVER_REDIRECT : RedirectPolicy.AUTO_REDIRECT; final UrlInfo urlInfo = parseRequest(request); // check if the URL is long enough and starts with the proper segments if (urlInfo != null) { PageComponentInfo info = urlInfo.getPageComponentInfo(); Class<? extends IRequestablePage> pageClass = urlInfo.getPageClass(); PageParameters pageParameters = urlInfo.getPageParameters(); if (info == null) { // if there are is no page instance information // then this is a simple bookmarkable URL return processBookmarkable(pageClass, pageParameters, redirectPolicy); } else if (info.getPageInfo().getPageId() != null && info.getComponentInfo() == null) { // if there is page instance information in the URL but no component and listener // interface then this is a hybrid URL - we need to try to reuse existing page // instance return processHybrid(info.getPageInfo(), pageClass, pageParameters, null); } else if (info.getComponentInfo() != null) { // with both page instance and component+listener this is a listener interface URL return processListener(info, pageClass, pageParameters); } else if (info.getPageInfo().getPageId() == null) { return processBookmarkable(pageClass, pageParameters, redirectPolicy); } } return null; } catch (MapperRedirectException e) { log.debug("Redirecting '{}' to canonical page: {}", request.getUrl(), e.getPageProvider()); // return new RedirectRequestHandler(redirectUrl, 301); return new RenderPageRequestHandler(e.getPageProvider(), RedirectPolicy.ALWAYS_REDIRECT); } } What it does is allow freeform root URI paths, e.g. http://www.tuneeca.com/t-1113012 instead of the longer http://www.tuneeca.com/product/t-1113012 . Now, requests to http://www.tuneeca.com/product/t-1113012 are also handled by the same RequestMapper and will be redirected to http://www.tuneeca.com/t-1113012 . However, currently it's using 302 temporary redirect. How to make it use 301 permanent redirect? Thank you. Hendy -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-instruct-RenderPageRequestHandler-to-redirect-using-301-Permanent-tp4668716.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org