apache - redirect wordpress child pages to their parent page -
i have glossary page in site child pages this:
http://my-domain.com/glossay/a/ http://my-domain.com/glossay/b/ http://my-domain.com/glossay/c/ ...
& every item in glossary has it's own child page based on alphabet this:
http://my-domain.com/glossay/a/abandon/ http://my-domain.com/glossay/a/art/ http://my-domain.com/glossay/b/bee/ ...
i need redirection rule redirect users items child page, parent page based on first word. example:
http://my-domain.com/glossay/a/abandon/ redirects to: http://my-domain.com/glossay/a/ http://my-domain.com/glossay/b/bee/ redirect to: http://my-domain.com/glossay/b/
thanks.
the following .htaccess rule should trick:
rewriterule ^glossay/([a-za-z])/.+$ /glossay/$1 [l,r=302]
basically that's after letter gets truncated , user redirected parent letter. note rule redirect children of children, if (e.g. /glossay/a/another/children redirected /glossay/a)
Comments
Post a Comment