mod rewrite - Apache: Remove "www." and redirect to sub directory -
on web server have installed wordpress sub folder /wp
.
want use apache's mod_rewrite achieve following:
- redirect
www.domain.com
trafficdomain.com
- redirect traffic sub folder
/wp
i tried following in root's .htaccess
file:
rewriteengine on rewritecond %{http_host} ^(www\.)?domain\.com$ rewriterule ^(/)?$ wp [l] rewritecond %{http_host} ^www\.domain\.com rewriterule ^(.*)$ http://domain\.com/ [r=permanent,l]
but not work intended.
ideas doing wrong here?
edit: have solved first requirement changing latter 2 lines to:
# redirect www.domain.com domain.com rewritecond %{http_host} ^www [nc] rewriterule ^.*$ http://domain.com/$0 [r=301,l]
the second requirement still open though ...
append additional rule:
rewriterule (?!^wp/)^(.*)$ /wp/$1 [l,nc]
Comments
Post a Comment